chrisg

Dynamic file names to MOSS

 

So you are building out some great blackpearl processes that use InfoPath and MOSS? But you may want to dynamically rename a file that someone attached in an InfoPath form and upload it to a MOSS server?

 

Well there is not a way to do so in the wizard but if you are willing to break into some simple code I think the following method would work…

 

if (K2.ActivityInstanceDestination.ActivityInstance.SingleInstance || K2.ActivityInstanceDestination.User == null)

            {

                //Create the unique file name - there will always only be one for single instance

                _fileName = string.Concat(K2.Event.Activity.Process.Name, " - ",

                    K2.Event.Name, " - Task for ",

                    K2.SerialNumber.Replace(",", "_"), ".xml");

            }

            else

            {

                //Create the unique file name

                _fileName = string.Concat(K2.Event.Activity.Process.Name, " - ",

                    K2.Event.Name, " - Task for ", K2.ActivityInstanceDestination.User.Name.Replace("/", "_").Replace("\\", "_"), " - ",

                    K2.SerialNumber.Replace(",", "_"), ".xml");

            }

 

Happy coding!

Published Thursday, May 01, 2008 5:39 PM by chrisg

Comments

No Comments
Anonymous comments are disabled

About chrisg

I am responsible for community development for SourceCode. I have been in technology for over 14 years mainly in infrastructure and security. I absolutely love technology especially new stuff and gadgets.