Social media


            

Thursday, November 26, 2009

Saving workflow solution in site template.

Starting with release 1.5 Workbox allows you to save workflow definitions in site templates. This means that you can prepare a SharePoint site with multiple lists and workflows and deploy it to different locations. All you need to do is to save site as a template and use it to create other sites. Workflows will be deployed automatically on newly created site.

In order to get your workflows to work properly after you create new sites from STP, you need to prepare the STP correctly.

Follow these steps to create a properly working workflow solution:
  1. Configure a site that you want to save as template. Create all lists and workflows you need. Test if everything is working as it should.
  2. Delete all content you do not want to save inside the template.
  3. TURN OFF the Workbox feature.
  4. Save site as STP. REMEMBER TO CHECK THE “Save content” CHECKBOX.
When you want to deploy a solution:
  1. Create a new site using your STP as a site template.
  2. After the site is created, turn on the Workbox feature.
  3. Wait for the feature to activate.
  4. After all the workflows are matched, you will receive an e-mail with log of the match process. If there were any errors during lookup matching, you will get notification. This log is also accessible from the Workbox workflow administration page. Workflows that did not match correctly will be listed in the log and marked with red exclamation marks on the workflow list.
  5. If there were workflows which haven’t been matched properly, open each of them in Workbox Designer. You will be taken automatically to the matching form, where you would be able to manually match all the lookups that could not be matched automatically. When finished, deploy the workflow.
NOTE: Instances of running workflows are not saved. This means that if you have any working or completed workflows on items, these workflow instances will be lost. This includes workflow history for all items.

Here are few facts that will help you to understand the workflow deploying process:
  • Workbox workflows are dependent on object GUIDs. These are unique IDs that allow Workbox to identify SharePoint elements (sites, lists, items). When you create new site, these GUIDs are generated anew. This causes workflow definition to point to locations it cannot recognize. To fix this problem, workflow lookups must be matched again after the site is created.
  • Workbox tries to match workflow definitions when you turn on the Workbox feature. This is the same matching functionality you know from when you import workflow definition from file. When you turn the Workbox feature on, Workbox will automatically try to match all the workflows and deploy the workflows that were deployed when the template was created.
  • Workbox may be unable to match lookups automatically if your template is referring to some objects outside the site – other sites, permission levels, SharePoint groups – that do not exist in the new environment. In such case you need to match those lookups manually. Workbox will detect such situation and tag unmatched workflows. If you open them with Workbox Designer, the matching window will come up, allowing you to manually point the desired objects. When corrected, workflow must then be deployed.
  • Workflow definition is stored as a file on SharePoint library. To include the workflow into the site template, you must include the content in the site definition by checking the “Include content” checkbox.
  • Workflow instance data is stored outside the site. That’s why information about any running or completed workflows will be lost. We advise you to save to definition only the data that is necessary for the solution to work (e.g. workflow libraries, mail data, etc).
  • Aside from lookup matching, Workbox also performs authorization provider match. It determines whether you use Active Directory or Forms Authentication and tries to match domains or membership providers with those which can be found in a new environment. If it cannot find a domain or membership provider with the name provided in a workflow definition, it assumes the first found domain or membership provider, ignoring the internal NT AUTHORITY and SHAREPOINT domains.