Sharepoint 2010 : Designing a Workflow Using Visio 2010 (part 2) - Implementing a Visio Workflow Using SharePoint Designer

10/12/2013 3:53:12 AM

2. Implementing a Visio Workflow Using SharePoint Designer

In the preceding section, you saw how to model a workflow using Visio and create an interchange file that can be imported into SharePoint Designer. In this section, we’ll move on to flesh out the logic defined in Visio using the built-in workflow activities available via SharePoint Designer.

  1. In SharePoint Designer, select Workflows from the Site Objects pane.

  2. In the Workflows ribbon’s Manage section, click the Import From Visio button.

  3. Browse to the PublishingProcedure.vwi file that we created in the preceding section. Click Next to import the file.

  4. In the Import Workflow From Visio Drawing dialog, type the Workflow name as Product Publishing. Two different workflow types are available: List Workflow and Reusable Workflow. The main difference between these workflows is that the List Workflow is attached to a particular list and cannot be used by multiple lists, whereas a reusable workflow can be bound to any number of lists or content types. List workflows provide comparable functionality to SharePoint Designer workflows in MOSS 2007. Choose Reusable Workflow as the type, and then from the content types drop-down, select Product. The completed dialog will look like the following illustration. Click Finish to complete the import process.

    Once our Visio model has been imported, SharePoint Designer will create a new workflow named Product Publishing and will automatically open the workflow editor, shown next, where we can complete the configuration of the workflow.

  5. The logic steps from our Visio model have been automatically inserted into our SharePoint workflow, and hyperlinked terms in each step allow us to finalize the configuration. In the Collect Technical Details from Engineering Department step, click the data hyperlink so that we can define exactly what data should be collected. In the Custom Task Wizard that appears, click Next to begin creating a new task.

  6. Name the new task Collect Technical Details. Click Next to add fields for the data in which we’re interested.

  7. Add a field and name it Technical Data. Set the Information Type to Multiple lines of text. Click Next, accept the default columns settings, and then click Finish to add the field.

  8. Click Finish to complete the Custom Task Wizard.

Using Workflow Variables

Now that we’ve created a custom task to capture data, we need a way to retrieve the data that we’ve captured so that we can do something useful with it. As its name suggests, the Custom Task Wizard creates a task with a custom form. When a user completes the form, any data captured is stored in the associated task. The output of this step is an identifier for the task item that was created. As you’ll see later, we can use this to pick up a reference to the task and from there access any data that was captured in our custom form.

You’ll remember reading about workflow rules and variables. Since we need to use our task identifier in another step of our workflow, we must create a variable and assign the output to it.

  1. To add a new variable, click the Local Variables button from the Workflow ribbon. Add a new variable named TechnicalDetailsTaskId with a type of List Item Id, as shown next. Click OK.

  2. To assign the output of our Collect Technical Details task to our new variable, click the (Output to collect) hyperlink and then select Variable:TechnicalDetailsTaskId.

  3. Use the Custom Task Wizard to add a Collect Product Image from Marketing Department step. This time, add a field and name it Product Image of type Hyperlink or Picture and uncheck the Allow Blank Values option in Column settings. Add a variable named ProductImageTaskId to store the output of the task.

  4. Now that we’ve configured our data capture tasks, the only item remaining is the approval action. Click the this item hyperlink to select the items that should be the subject of the approval process. In our case, it should be the Current Item.

  5. With these configuration changes in place, our revised workflow should look like this:

Using Initiation and Association Forms

You’ll notice that a few properties still need to be configured. These properties contain details of the users to which each task should be assigned. Generally speaking, properties such as these, which are likely to change over time, should be user-configurable—that is, the user should be able to change them without having to edit the underlying workflow. SharePoint workflows provide two forms for user configuration: the Association form, which is presented when a workflow is attached to a list, and the Initiation form, which is presented when a workflow is manually started.

There’s one thing to bear in mind when using the initiation form: it’s not shown if the workflow is started automatically. So, for example, if we created a workflow that was set to start every time an item changed, the initiation form would never be shown.

In the case of our workflow, an association form is a more appropriate choice, because it allows us to define parameters that can be set at the list level.

  1. To define a parameter that appears on an association form, click the Initiation Form Parameters button in the ribbon. Add a new field named Engineering Department with an Information type of Person or Group. In the Collect From Parameter During drop-down, select Association (Attaching To A List). In the Column Settings dialog, uncheck the Allow Blank Values option and select the All Users radio button in the Choose From section. Click Finish to add the parameter.

  2. Repeat step 1 and add a Marketing Department parameter and an Online Sales Manager parameter.

  3. To bind these parameters to our workflow actions, click the this user hyperlink. Since we’re binding to a parameter rather than an actual user, select Workflow Lookup for a User. Click Add to configure the parameter binding. In the Lookup for Person or Group dialog, select Workflow Variable and Parameters as the Data source. Our association form parameters can now be selected from the Field From Source drop-down. Select the appropriate parameter and then click OK to complete the binding.

  4. Repeat step 3 to bind all association form parameters to our workflow actions. The completed workflow should look as illustrated:

Using the SharePoint Designer Lookup Dialog

Although we’ve configured the actions that were imported from Visio, the end result of our workflow in its current state won’t be quite as we expected. Although we’re collecting data from engineering and marketing, we’re not actually attaching that data to our product, it’s stored in the custom tasks only. To fix this problem and achieve the desired result, we need to add a few more actions.

Moving the mouse to the end of the list of workflow steps will show an orange cursor. Click the cursor to open a text box that can be used to search for the action that we want to add next. (This cursor appears between each workflow action and before the first action, so we can add actions wherever we need them.)

  1. Type Set f and then press the enter key to insert a Set Field in Current Item action. Configure the field as Technical Details and then click the value hyperlink. Click the fx button to display the Lookup dialog.

  2. You’ll remember that the data entered in our custom task forms is stored in the task. Using the Lookup dialog, we can extract this data using the ID of the task in which we’re interested. Set the data source to Tasks. When a workflow is associated with a list, one of the mandatory parameters is the name of a task list to be used by the workflow for creating tasks. This task list can be referenced using the Tasks data source.

  3. In the Field From Source drop-down, select Technical Data. The column contains the details that a user enters in the custom Collect Technical Details form.

    Since the data source to which we’re binding contains potentially more than one item, we need to filter it to return only the specific task in which we’re interested.

  4. In the Find the List Item section, set the Field to ID and then click the fx button to show the Lookup dialog. In that dialog, set the Data Source to Workflow Variables and Parameters and the Field From Source to Variable: TechnicalDetailsTaskId. Since we intend to use this to look up an item, set the Return Field As to Item Id, as illustrated:

  5. We’ve added this action at the end of the workflow when really it makes more sense to attach this data before sending the product record for approval. To move the action up, highlight it and then click the Move Up button on the Workflow ribbon.

  6. Add a new Set Field in Current Item action directly underneath the action. Use the Lookup dialog to attach our Product Image data.

  7. Click Save to commit these configuration changes.

We’ve now completed our first workflow using SharePoint Designer and Visio. The finished workflow should look as shown:

Top 10
Review : Sigma 24mm f/1.4 DG HSM Art
Review : Canon EF11-24mm f/4L USM
Review : Creative Sound Blaster Roar 2
Review : Philips Fidelio M2L
Review : Alienware 17 - Dell's Alienware laptops
Review Smartwatch : Wellograph
Review : Xiaomi Redmi 2
Extending LINQ to Objects : Writing a Single Element Operator (part 2) - Building the RandomElement Operator
Extending LINQ to Objects : Writing a Single Element Operator (part 1) - Building Our Own Last Operator
3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
Popular Tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8