Thursday, April 21, 2011

Develop Workflows Using Visio and SharePoint Designer.

In this post you will learn the new feature of SharePoint 2010 i.e. workflows with Visio. You can create sequential workflows with Microsoft Visio. Let us explore how to create the basic workflow using the great feature.

1. Open Visio 2010.

2. Select the Flowchart category from the Template categories.

3. Select the Microsoft SharePoint Workflow template.

clip_image002

4. Click the Create button.

You can find actions, conditions and terminators specific for SharePoint workflows in SharePoint Workflow Actions section.

clip_image004

5. Add a Start and Terminate action to the Designer.

6. Add a Compare data source action to query the user that opens the task and to check whether this is an important task or not.

clip_image006

7. Add two Log to History list actions.

clip_image008

8. Select the Connector button in the ribbon.

clip_image010

9. Join connector between the Start, Compare data sources, the action on the left and the action on the right.

clip_image012

10. Double click the Compare data source condition to change the text into “Compare actions”

11. Double click the left action to change the text into “Action on Left”.

12. Double click the right action to change the text into “Action on right”.

One of the connectors between the condition and an action needs to be set to No.

13. Right-click the left connector and choose Yes.

14. Right-click the right connector and choose No.

Now the workflow is ready to export. This workflow can be easily exported to share point designer the workflow gets a name with .vwi extension. The export file is an XML file containing XOML, which is the format in which SharePoint stores its workflows.

15. Save the workflow as VisioWorkflow.

16. Select the Process tab and click the Export button.

clip_image014

17. Give the export format the name VisioWorkflow.

SharePoint Designer.

1. Open SharePoint Designer 2010 and open your SharePoint site where you want to deploy the VisioWorkflow workflow.

2. Select the Workflows collection in the left pane.

3. Click on the Import from Visio button.

clip_image016

4. Click this button and browse to the VisioWorkflow.vwi file you created with Visio 2010.

5. Click the Next button.

6. Select the list on which you want to associate VisioWorkflow workflow.

clip_image018

7. Click the Finish button.

8. In designer you can see and edit your workflow.

clip_image020

9. Click the Initiation Form Parameters button from the ribbon. A dialog appears.

10. Click Add button in the dialog.

11. In the Add Field dialog enter a field name, i.e. compare actions.

12. Select a data type from the last dropdown list, i.e. Yes/No.

clip_image022

13. Click the Next button.

14. In the second screen of the Add Field dialog you can set a default value. Choose No.

15. Click the Finish button and Click the OK button.

16. In Designer select the first value hyperlink in the condition

17. Now the workflow is ready to publish to SharePoint.

18. Click the Publish button in the ribbon to publish the workflow to SharePoint.

19. Open an internet browser and navigate to your SharePoint site.

20. Select the list for which you have created the work flow.

21. Add new item in the list .

22. Select the dropdown next to the list item and choose Workflows.

clip_image024

23. Select Visio workflow.

clip_image026

24. Click button to start the workflow. This makes the initiation form to appear.

clip_image028

25. Click the Start button.

26. When the workflow stops running, the list is shown again. Selected the Completed hyperlink to navigate to the Workflow status page.

clip_image030

clip_image032

Saturday, March 12, 2011

Built-in Workflows Share Point 2010.

I found the following tutorial to use built-in workflows on office.microsoft.com.

Add a workflow to a list or library



  1. Browse to the list or library where you want to add the workflow.

  2. Click the List tab if it’s a list, or the Library tab if it’s a library.

  3. In the Settings group, click Workflow Settings.

  4. On the Workflow Settings page, click Add a workflow.


Add a workflow to a list or library content type



  1. Browse to the list or library containing an instance of the list content type you want to modify.

  2. Click the List tab if it’s a list, or the Library tab if it’s a library.

  3. Click List Settings if it’s a list or Library Settings if it’s a library.

  4. Under Content Types, click the name of the content type you want to associate the workflow with. If you don’t see Content Types on the page, you may need to choose Advanced Settings and then Allow management of content types.

  5. Under Settings, choose Workflow settings.

  6. Click Add a workflow.


Add a workflow to a site content type



  1. From the home page for the site collection, choose Site Actions and then Site Settings.

  2. Under Galleries, click Site content types.

  3. Click the name of the site content type you want to add or associate the workflow with.

  4. Click Workflow Settings.

  5. On the Workflow Settings page, click Add a workflow.


The Add a Workflow page

Performing any of the steps above brings you to the Add a Workflow page where you choose the type of workflow, name of workflow, task list to use, etc.

clip_image001

On this page, you can configure the following workflow settings:



  • Choose a workflow template, like Approval,

  • Specify a name for the workflow.

  • Specify the Task list to use for the tasks in this workflow.

  • Specify the History list to use for this workflow.

  • Allow the workflow to be manually started by users.

  • Require the Manage Lists Permissions to start the workflow.

  • Start the workflow to approve publishing a major version of an item.

  • Start the workflow when a new item is created.

  • Start the workflow when an item is changed.


The association form

The next page shows the workflow behaviors that you can change, like the approvers, workflow message, and due dates. The values you choose become the default values when users start the workflow – in other words, you fill out the association form exactly once, when you add the workflow to a list, library, or content type, and those values are used in all subsequent instances of the workflow.

The association form is different for each of the workflows included with SharePoint. This is what you see when associating Approval workflows.

clip_image002

On this page, you can specify the following workflow behaviors:



  • Approvers for the workflow.

  • Order of approvers: serial or parallel

  • Stages of approval.

  • Expand groups by assigning tasks to every member of the group.

  • Request message that appears in the workflow.

  • Due date for all tasks.

  • Duration per task.

  • Duration units: days, weeks, or months.

  • CC, who to carbon copy the assigned tasks.

  • End the workflow on first rejection.

  • End the workflow if the document changes.

  • Enable content approval by updating the approval status when the workflow completes.


Starting the workflow

Once the workflow has been associated with a list, library, or content type, you and others are ready to start using the workflow. If you chose to start the workflow when items are created or changed (on the Add a Workflow page), users won’t see a difference or even know a workflow has started when creating and updating documents or list items on the site. When these options are not selected, users start the workflow on their own, manually.

They do this by choosing the Workflows option from within the Office 2010 application used to create the document, or they can choose the Workflows options from the list or library where the item is stored, such as the pull-down menu beside the list item.

clip_image003

Clicking here, takes the user to the Start a New Workflow page, which shows the available workflows that can be started plus the status of other workflows that are running and have completed.

clip_image004

Lastly, they see the workflow initiation form where they can specify the core behaviors of the workflow. In contrast with the association form, which is completed exactly once when the workflow is first added to a list, library, or content type, the initiation form is completed once each time the workflow is started manually – so each instance of the workflow can use different initiation form values, but they all use the same association form values.

The form is different for each of the workflows included with SharePoint, and default values will appear in the form if they were added to the association form (as described earlier). The Approval workflow initiation form, without any default values, looks like this.

clip_image005

The person starting the workflow can add new values or leave the defaults and then choose Start. This creates a task and assigns it to the first approver listed.

Approving the workflow

For the approvers listed in the workflow, they receive a task assigned to them, and they receive an email notification. They can approve or reject the task directly from within certain Office 2010 applications, like Outlook – or they can go directly to the Tasks list, where they will see the new task assigned to them.

When they open the task, they see the task form that they can use to approve, reject, request a change, or reassign the task. The task form for the Approval workflow looks like this.

clip_image006

Depending on the approver’s actions, the task might be assigned to the next approver, sent back to the author with requested changes, or approved, which completes the workflow.

Develop Basic Approval Workflow Using Visual Studio2010 and Infopath2010.

In this exercise you will extend the previous workflow to implement the basic approval process using Visual studio2010 and Infopath2010.

1. Open (Last Post Project)in visual studio 2010:

clip_image002

2. In solution explorer expand Workflow1 and double click on Element.Xml file.

clip_image004

2. In the workflow definition file (Element.xml), set the TaskListContentTypeId attribute of the Workflow element to the following content type. This content type, included in Microsoft SharePoint Server 2010, specifies custom task display and edit forms that include an Office Forms Server control for rendering InfoPath forms.

TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"  


clip_image005

3. Let us create task form using InfoPath 2010 through which an approver can approve and reject the request.

a. open InfoPath 2010 and select blank form in popular form templates then click design form button.

clip_image007

b. add title and controls from Home tab in ribbon as mentioned below.

clip_image009

c. right click on Fields pane on right side and select add then specify the field status as text.

clip_image011

clip_image012

d. In Data tab of ribbon select data connections and click add button.

clip_image014

clip_image016

e. select create new connection to submit data and click next button.

clip_image018

f. select to the hosting environment, such as an ASP.Net page or hosting application and click next .

clip_image020

g. Enter the name for data connection and then click Finish button.

clip_image022

a. Click close button.

clip_image024

I. Double Click on Approve button then on ribbon you will find Control Tools tab in this click on rules button.

clip_image026

j. Click Add button then select set field value clip_image028

k. Again click on Add button and then select SubmitData.

clip_image030

L. Again click on Add button and then select Close the form.

clip_image032

M. Repeat all steps from I-L for reject button but set status to rejected while setting a field status.

N. Double click on close Button click rules click on Add button select Close the form.

O. Save the form with the name ApproveReject2010.


Publish the form:
To publish the form click on file tab on ribbon then select publish.
clip_image034
Select Network location Option then click on browse button. Specify the following location in file name and click ok then on this location make a new folder with name Forms.C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\WorkFlowLab1_Feature1 this is the location where workflow is published.
clip_image036

Specify the name Of File =” ApproveReject2010.xsn” Click ok then click next.

clip_image038

Clear the textbox on next screen then click next then publish and close the form.

clip_image040

clip_image042

Now go to the location C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\WorkFlowLab1_Feature1\Forms right click on approvereject2010 file then click on design this will open the published form.

clip_image044

Now on file tab on ribbon select Info then in right pane click on Form template Properties.

clip_image046

Copy the text in Id.

clip_image048

Close the form and return to visual studio2010.

3. Add an element to the Metadata element of the workflow template definition. This element is TaskID_FormURN Element (Workflow), where N represents the integer you assigned to that task type within the workflow. Set this element to the URN of the InfoPath 2010 form you want to use with this task.

<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:ApproveReject2010:-myXSD-2010-08-22T06-49-46</Task0_FormURN>

clip_image050

In solution Explorer Expand Feature1 then double click on Feature1.feature.

clip_image052

Click on manifest then click on edit options.

clip_image054

clip_image056

Add <Property Key="RegisterForms" Value="Forms\*.xsn" /> tag under Peroperties tag and Click on overwrite generated xml link.

clip_image058

clip_image060

Click on Edit in XML editor link then add following Tags.as mentioned in screen shot below.ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"clip_image062

2. Setup the auto association parameters that will tell Visual Studio to automatically associate your workflow with the TestList when it is deployed.

a. Select Workflow1 in the solution explorer. clip_image064

b. In the Properties window, set the Auto Associate property to True.

c. In the History List property click the [...] button to start the wizard.

d. Click Next >, On the 2nd page select a list of Shared Documents in the first dropdown and click Next

clip_image066

e. On the final page check the first check box and clear the rest and click Finish.

Deploy the workflow to SharePoint and verify that it works.

f. Right click the project in solution explorer and click Deploy.

g. When the deployment is complete, open Internet Explorer and navigate to http://localhost/Shared%20Documents/Forms/AllItems.aspx.

Click on add Document link and then upload the document.

clip_image068

Click the drop down menu on the Expense Report in the list and select Workflows

clip_image070

Click the WorkFlowLab1-Workflow-1 link to start the workflow.

clip_image072

Click the In Progress link under WorkFlowLab1-Workflow-1 to track the workflow

clip_image074

Click on Task mentioned in Task List notice that task is associated with our custom content type defined by InfoPath ApproveReject from.

image