Is it Possible to Rename a Form Once a Process has been Started?

Applies To

Summary

Is it possible to rename a form once a workflow process has started?

Yes, and the workflow process will continue to run, but for AgileParts such as MoveFiles, it will assign the original name because the SharePoint Portal Server Integration uses the document location as the process instance name. Currently, AgilePoint stores only the latest document location as a custom attribute during the move event.

NOTE: We are taking a closer look at the moment to see if we can extend that.

Details

One option for renaming a form once a workflow process has started is to use the original name for the current process, then when the file is ready to move into the next state such as modification or published, move the file and then rename it in the new location.

Another option would be to create a Rename AgilePart that renames the current document. Reference the SharePoint SDK, it provides API that you can use to modify fields in the existing document including the document name. To change the name of the document, the Field_Name should be Title or Name according to your need.

You can then use this Rename AgilePart as the last step in your process template to rename the document when the process is completed. The following are code snippets extracted from the SharePoint SDK document:

SPSite siteCollection = SPControl.GetContextSite(Context);
SPWebCollection sites = siteCollection.AllWebs["Site_Name"].Webs;
foreach (SPWeb site in sites)
{
SPListCollection lists = site.Lists;
for (int i=0; i<lists.Count; i++)
{
if (lists[i].Title == "List_Name")
{
SPField fieldChange = lists[i].Fields["Field_Name"];   
fieldChange.DefaultValue = "Default_Value";
fieldChange.Description = "Description";
fieldChange.Title = "New_Field_Name";
         fieldChange.Update();
}
}
}

You can then leverage this Rename AgilePart as the last step of your process template to rename the document when the process is completed.