Quantcast
Channel: Serge Luca's Blog (SharePoint MVP) » Sharepoint 2010 Workflow Tutorial
Viewing all articles
Browse latest Browse all 10

Step by Step tutorial : Creating Workflows for SharePoint 2010 tasks (Step 4/15)

$
0
0

 

image_thumb_thumb

SharePoint 2010 workflow tutorial

  1. Step 1.
  2. Step 2.
  3. Step 3.
  4. Step 4.
  5. Step 5.
  6. Step 6.
  7. Step 7.
  8. Step 8.
  9. Step 9
  10. Step 10.
  11. Step 11.
  12. Step 12
  13. Step 13.
  14. Step 14.
  15. Step 15.

SharePoint 2007 workflow tutorial

  1. Step 1.
  2. Step 2.
  3. Step 3.
  4. Step 4.
  5. Step 5.
  6. Step 6.
  7. Step 7.
  8. Step 8.
  9. Step 9.
  10. Step 10.
  11. Step 11.
  12. Step 12.
  13. Step 13.
  14. Step 14.
  15. Step 15.
  16. Step 16.
  17. Step 17.

Scenario

If the expense reports requires the manager approval,  we want the manager to receive a task in his task list in order to approve/reject the expense report.

 

CreateTask activity

 

Let’s drag and drop a CreateTask activity before the askManager activity and name it approveRejectTask

image

Set its Correlation token to ApproveRejectToken and the associated ownerActivityName to ExpenseReportWorkflow:

image

 

Bind the TaskProperties property to a new member (click on he ellipsis button…):

 

image

Bind the TaskId to a new member (field): ApproveRejectTaskId.

Double click on the ApproveReject task to generate a new event handler and  store a new Guid into ApproveRejectTaskId, set the task title, and associate the task with the manager:

image

 

Remove the askManager activity.

OnTaskChange activity

Add a new OnTaskChange activity and rename it waitForApprovalRejection:

 

image

Any event coming form the task will be handled by the waitForApprovalRejection activity if we group them with the same correlation token (you ‘ll have a better understanding of the correlation token in the next tutorial).

Set the correlation token to ApproveRejectToken.

This is not enough, the event doesn’t carry the taskId : you still need to associate this activity with the taskId:

Bind the the TaskId property to an existing member: ApproveRejectTaskId.

If we consider that when the user replies, the task should complete, then we need to drag and drop a CompleteTask activity

 

CompleTask activity

 

Name it approveRejectTaskComplete.

Set the correlation token to ApproveRejectToken.

Bind the TaskId property to an existing member: ApproveRejectTaskId.

Just to make sure everything will work ok, change the Show field  setting of the Created By column the Expense Reports list to account;

image

Do this as well for the column Manager and Manager Of (list Managers).

Log in a BrianC, add an expense report and run the workflow : the workflow should have the status “In Progress” as illustrated in the next picture :

 

image

 

The workflow is actually waiting for an event  in the waitForApprovalRejection activity : the event will be trigger when a task will be edited.

In the Tasks list a task as been created and assigned to Brianc manager : Amay Albert as illustrated in the next picture :

image

When we click on the task title, the following dialog will show up

image

If we edit the task and set the task as completed (for instance).

image

The task form that shows up is the default task form; we will replace it with a customized form in a next version of this tutorial.

The workflow is not In Progress (it is not waiting anymore)

image

Source code can be downloaded here.



Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images