Tuesday, July 09, 2013

The Quasi-Definitive End to End InfoPath Deployment Guide: Act 3

Erik Abderhalden

Act 3: Deploying the Workflow

For those keeping score at home, in the first act we saved the assets we would need for our deployment. In act two we deployed all of our assets with the exception of the workflow. In this, our last act of the original InfoPath deployment trilogy - there will be no prequels I promise - we're going to deploy our workflow and associate it to our form's content type.

As we once again proceed to give you what you need, the only assumptions in this post are you have followed the previous two posts and have your workflow saved as a template. If you haven't read the posts, fret not. You can return to the first post and catch up.

Add the workflow to your site and activate it

  • In your new environment go to Site Actions>Site Settings>Galleries>Solutions
  • Upload the WSP file that contains your workflow
  • Activate the solution using the ribbon
  • Navigate to your Site Settings>Site Features
  • Scroll to the bottom and activate “Workflow Template [Form Name] from Web Template”

The workflow from our previous site has been added to the site and is ready to be hooked up to our form's content type

Publish the Workflow

  • Open your site collection in SharePoint Designer
  • Click Workflows from the left-hand navigation
  • In the Reusable Workflow section find the workflow that was provisioned when you activated the feature
  • Right click the workflow and select Copy and Modify
  • Give the workflow a new name
  • In the Content Type drop down, select the name of the form published. Click OK.
  • When the workflow copies, click Save

Make sure everything is copacetic

While we may have a new workflow, that doesn't mean it's going to work right out of the gate. When deploying workflows between environments it's best to jump into the workflow and make sure everything looks good before we hit the Publish button.

Ok, so what do I mean by "everything looks good"? Sometimes SharePoint Designer workflows can look a little mucky. In particular, our variables may be a little off and that can break our workflow.

Add Fields to the Task Form Fields

If you're not using any fields in the task form field, skip ahead to the next section.

Within the workflow add the Task Form Fields one at a time. Remember, we're not in a rush here. Should you get an error after adding a field, close SPD, add a field, Save the workflow, close SPD and repeat. I'm not sure what causes this behavior, but I've seen it in several environments and this is a workaround to SPD's wonkiness.

Check your variables

Go through the workflow and look for any anomalies. These are usually found by looking through the workflow actions and seeing if you see something out of the ordinary. If you see [email protected]#$%^&*() or a GUID where it shouldn't be, that's what you need to fix. What does fixing entail? Correct the variable to be the correct value. Forgot what it should be? No worries. Open up your previous environment in SPD and take a peek at the workflow there.

How thorough do you have to be in checking your variables? Very thorough - even if you have a small, two action workflow - do your due diligence and check everything out. Check where you set your variables and any time you might be using Current Item. The more you use variables the better because that's fewer places to check. If you use Current Item all over your workflow, the more places you have to check, and the more places that your workflow can break when deploying to a new environment.

As you publish more workflows between environments, you'll get better and faster at this. What may seem time consuming now will take minutes a few deployments later.

When you've finished checking out the workflow, publish the workflow by clicking Publish in the ribbon

Associate the Workflow to the Content Type

  • In your new site collection go to the form's content type: Site Actions>Site Settings>Site Content Types
  • Find the form content type (It can be found in the Microsoft InfoPath content type group)
  • Click the content type’s name
  • Click Workflow Settings
  • Click Add Workflow
  • Select the Workflow that was published in the previous section
  • Give the workflow a name.
    • Note: This is the name that end users will see
  • Enter the name of the task list
  • Set the Start Options to be “Start this workflow when a new item is created"
  • Click OK

Phew! After reading these three long posts and working with a lot of moving parts we now have the form and the workflow published in a new environment. So we're done, right? Not so fast.

Before you drop the mic and walk away, submit a new form and make sure that the workflow is working. Run through every possible scenario and make sure it's 100% operational. Once you've done your due diligence with testing, you may now drop the mic.

Loading Next Article