80 likes | 177 Views
Converting SharePoint Workflows. Presented by RJB Technical Consulting. Problem Overview.
E N D
Converting SharePoint Workflows Presented by RJB Technical Consulting
Problem Overview SharePoint Designer can make simple, easy workflows for any SharePoint site. These workflows, however, are restricted to the site they were created against, owing to site-specific GUIDs hard coded into each workflow.
What is a GUID? • A Globally Unique Identifier, or “GUID”, is a special type of identifier used in SharePoint to provide a reference number which is unique in any context • GUIDs are generated using elements such as the MAC address of a computer to nearly guarantee a unique number being generated • There are more possible GUID combinations than there are observable stars in the sky (3.4 x 10^38 combinations vs 5 x 10^22 stars observable from Earth) • Because GUIDs are unique between SharePoint sites, this makes references difficult to create as universal
Why does this matter? • References to specific lists will not be the same • References to columns will not be the same • References to sites will not be the same • SharePoint Designer workflow would have be rebuilt nearly from scratch on each site in the progression from Development to Production • This is both time consuming and dangerous • One mistake or variance and the workflow can fail
How does Visual Studio help? • With a Visual Studio workflow, we have far more depth to work with than SharePoint Designer • Programmatically, we can get the GUID of the objects our workflow needs • Some methods accept other information in place of a GUID – which we can’t do in Designer • Visual Studio lets us “featurize” our workflow for deployment to SharePoint
Key steps • Five key variables are required by almost every workflow: Initialization parameters, Context, ID, Item ID, and List • Removal of the Designer workflow initialization activity • Replacing the aforementioned activity with our own initialization method • Replace SharePoint Designer variables with strongly identified variables • Replace references in the code to GUIDs with variables or specific names of lists and columns • Replace any GUIDs in the aspx forms of the site
Finishing up • Package core solution as a wsp (recommend WSP Builder) • Provision form files, images, and other elements • Create a batch script to install and deploy your feature with the workflow • Activate the feature on the target site • Add the workflow to a library or list
Proceed to Demo Good luck!