Create Lists
Create the following 2 lists (See description in previous post cited above):
- Core.NET Content (Document Library)
- Core.NET Approval Workflows (Custom List with following columns)
- Title: Single line of text
- File URL: Hyperlink or Picture
- Workflow Status: Choice (with following choice values)
- Content Analyst: User
- Awaiting Approval
- Pending Analysis & Review
- Awaiting Approval
- Approved
Create 'Approval Initiation Workflow' on the 'Core.NET Content' list
Open an instance of SharePoint Designer 2007 on your machine. Go to File > Open Site... and enter the URL for the site you created the lists on.
Go to File > New... > Workflow..., enter Approval Initiation Workflow as the name of the workflow, and select Core.NET Content from the drop down list. Make sure that only the second checkbox (Automatically start this workflow when a new item is created) is checked, and click Next
.

Create workflow action to insert an item into the second list
Enter Initiate Approval process for uploaded content as the Step Name. Click the Actions dropdown button and select Create List Item
from the dropdown. Click the this list link on the action, select the Core.NET Approval Workflows list from the drop down at the top of the 'Create New List Item' dialog, and specify the values for each of the columns as shown below:
- Title = Core.NET Content:Name
- File URL = Core.NET Content:URL Path
- Workflow Status = Awaiting Assignment
Click the Finish button to publish the workflow.

The above step simply takes values from the document library (Core.NET Content) and inserts into the Core.NET Approval Workflows list. We now turn our focus to the other list, and the second workflow.
Create 'Approval Process Workflow' on the 'Core.NET Approval Workflows' list
Create the workflow as below; enter Approval Process Workflow as the name of the workflow, and select 'Core.NET Approval Workflows' list from the drop-down. Make usre that the last 2 checkboxes (Automatically start this workflow when a new item is created + Automatically start this workflow whenever an item is changed) are checked.
Create Variables for the workflow
Click the Variables... button in the Workflow Designer window, and create variables as below:

The 'Approval Process Workflow' will consist of the following 3 steps:
- Get Workflow Data
- Process Workflow Status
- Process Approval/Rejection by Manager
- Update Workflow Status
Note: By updating the list in the very last step, the subsequent instance of the workflow (started on item update) can kick off immediately. If the current workflow updates the list while it still has some more activities to perform, the second workflow fails.
An explanation of each of the step follows:
Step 0: Terminate Workflow if already approved
This step is optional, hence I did not include it in the above list of steps. It simply checks to see if the item has already been approved, and if it is, terminates the workflow using the Stop Workflow activity.

Step 1: Get Workflow Data
This step simply intializes the values of the variables and comprises the following 2 steps:
- Set the ContentAnalyst variable to the value of the Content Analyst column in the Current item. (This value will be empty when the first instance executes)
- Initialize the UpdateStatus variable to 'No'.

Step 2: Process Workflow Status
This step relies on IF condition activities to process the workflow according to the Workflow Status for that particular instance of the workflow.

Refer to the diagram above; starting from the top
- The first time the workflow executes, the status is set to Awaiting Assignment, causing ONLY the Actions for the first Condition to execute. The action themselves are pretty straight-forward and self-explanatory.
- The second condition (where status equals 'Pending Analysis & Review') may be true a number of times, depending on the number of times the manager rejects the document.
Just like the second condition, this may be true multiple times depending on the number of times the workflow was submitted to the manager for approval.- Alternatively, you can also add a condition here to check if the workflow status is set if 'Approved', and terminate the workflow (as shown below).

Note: You can get the user input for a 'Collect Data from a User' action by simply referencing the column of the Tasks list named after that specific input you specified in the 'Custom Task Wizard' dialog.

Step 3: Process Approval/Rejection by Manager
This step was included since its not possible to have a nested IF statement in the Actions sections of a step.

Either one of the conditions can only be true if and only if the workflow status is Awaiting Approval. If the Manager APPROVED the document, the NewStatus variable is set to Approved, if the Manager REJECTED the content document, the NewStatus variable is set to Pending Analysis & Review, sending the workflow back to the Analyst specified by the Repository Manager.
Step 4: Update Workflow Status
This step MUST execute at the very end, to allow the successful termination of the current workflow instance and initiation of the subsequent workflow instance. Also, the UpdateStatus variable was explicitly set to 'No' at the very start of the workflow instance, and unless a step hasn't set it to 'Yes', the update action in this step will not execute.

This step updates the 'Workflow Status' column
to the value in the NewStatus variable, and the 'Content Analyst' column to the value in the ContentAnalyst variable (shown below).
31 comments:
Sweet, I was going to ask for this from your other post. This is perfect. I will try to follow this and let you know if I get lost.
Thx Peter
Adnan it works great. I have a question is it possible to parse out a multi choice column field from a list. As I have not found a way to do this so.?
I am sorry, but I am very confused on the collects and assing dialogs in step 2 that you said should be very straight forward. I think I am missing something, I hope you will expand a little on that step.
Thanks
@ Perseus109
For Step 2, the 3 IF conditions allow different activities to be performed depending on the value of Workflow Status variable; explained below:
Condition 1: Workflow Status == Awaiting Assignement
Use the Collect Feedback activity to assign a task titled 'Assign document to Analyst' to the Repository Manager. Since we are using the Collect Feedback activity, the actor (the Repository Manager in this case), will enter the name of the Content Analyst who needs to review the uploaded content. The Output to Variable: TaskItemId allows us to assign the auto-genarted Task Id to the TaskItemId variable. This TaskItemId would be used in the very next step to get the entered Analyst username for the task, and assign it to ContentAnalyst variable.
Assign the entered Content Analyst username to the ContentAnalyst variable. [Refer to screenshot to get an idea of how to get the entered feedback for a task using the TaskItemId variable]
Assign the next Status for the workflow (Pending Analysis & Review) to the NewStatus variable.
Set the value of the variable titled UpdateStatus to 'Yes'. This variable is used in the LAST step of the workflow top ascertain if the worfklow status needs to be updated.
Condition 2: Workflow Status == Pending Analysis & Review
Use the Assign a TODO task acticvity to assign a task titled 'Content Analysis Required' to the Content Analyst entered by the Repository Manager in the preceeding step, and stored in the ContentAnalyst variable.
Assign the next Status for the workflow (Awaiting Approval) to the NewStatus variable.
Set the value of the variable titled UpdateStatus to 'Yes'. This variable is used in the LAST step of the workflow top ascertain if the worfklow status needs to be updated.
Condition 3: Workflow Status == Awaiting Approval
Use the Collect Feedback activity to assign a task titled 'Content Approval Required' to the Managers group.
Assign the feeback entered for the task above to the ContentApprovalStatus variable. The feedback is entered using a radio button group for 'Approve' and 'Reject' response.
Keep in mind that the objects Tasks:Content Analyst (in condition 1) and Tasks:Approval Feedback (in condition 2) were created as a result of Collect Feedback activities used in each of the 2 conditions.
Hi, you can publish or share the template. I'm can't deploy fine this example.
Thanks.
Capa
carlosap@gmail.com
Hi,
I have WSS 3.0 and Sharepoint Designer no show me the Collect Feedback activity. what happens?
I will need something?
Thanks.
Capa
Hi Adnan,
I have query can assign task to the sharepoint group using Update list action in the sharepoint designer
@Radhakrishna
I am not sure why you would want to use the UPDATE LIST ACTION to assign a task to a group. You can, however, use it to update the Assigned To column of the Task list to assign/re-assign the task to a user or group. This also means you need to have the Task Id value stored in a workflow variable. If the task was created by the same workflow, the Task Id would be available for sure.
How would you set this up for multiple reviewers and stop the workflow in the event one rejected before all finished reviewing. I understand all must respond to satisfy the workflow steps but there must be a way to populate the empty responses once a reviewer has rejected so the workflow will end? I can't seem to find a clever work around for that.
Hi Adnan,
I am using Update list action in the sharepoint desinger to re-assign the task to the group but i am get following error.
‘Error loading and running event receiver Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventReceiver in Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Additional information is below.
: Thread was being aborted.’
I have do lookup as follows
workflow task
Update assinged to approvers
where workflow item id = current id
@Radhakrishna
In the Windows Workflow Foundation engine, once a task is created in the Tasks list, an OnTaskCreated event fires that returns the Task ID for the newly created task. This is something that happens behind the scenes and is handled by the SharePoint Timer Service (OWSTIMER.EXE). I am assuming that service is failing in your case.
I know for a fact that in SharePoint Designer 2007, you CANNOT update the task using the Update List action immediately after the Create Task step. ALSO, You can try separating out the Update List step into a separate action; this would ensure that the OWSTIMER.EXE has populated the Task ID before you try to access/update the task using the Task ID.
Hi Adnan,
Thanks for information, I created two workflows, primary workflow which will create task, it is configured to start on item created and secondary workflow which will update the assigned to column of the task and is configured to start on item changed. Still I get the same error. Is this a bug with Sharepoint desiger?
I truly apologize for bothering you with my question so much,
Thanks in advance for your valuable inputs.
@Radhakrishna
Its not a bug per se; it may be a limitation. While I understand that you created 2 workflows using the approach I outlined in my post, I dont understand how you expect the secondary workflow instance to kick-off if the Tasks list item is being updated and NOT the item in the list with which the secondary workflow is associated. Is the Tasks list your secondary list?
Hi Adnan,
Thanks once again, let me explain you what I have done,
I have a list say Order, any user can place an order (we have used Infopath forms for creating a new order). There is a business rule which says that if order total is greater than say $100 then it will be approved by direct manager else it will follow the regular path of approval i.e. admin group (this is sharepoint group). User can change order till order request is approved once it is approved or rejected user cannot change the order.
I have created a primary workflow on the order list which is described in the previous post is configured to start on the item created. I have create secondary workflow same list i.e. order list which is configured to start on item changed.
When user creates an order (with total price greater than $100), primary workflow will start it will create task for manager. User changes an order before manager can provides his/her approval/rejection and making the order total less than $100, at this point secondary workflow will start and assign the task to the admin group.
In the secondary workflow I have used Update list action Item to update the assigned to column of task list. This works fine if task is to be assigned to the individual but fails for group.
If failure to assign the task to the group via update list action in sharepoint designer is a limitation then I might have to think of alternate solution to it
Regards,
RK
@Radhakrishna
Let me point out that while you can use the Update List Item action to update the Assigned To column of a Task list, you still need the Task ID for the task you need to update to lookup the item in the Define Workflow Lookup dialog. However, lookups dont work if the Update Item action immediately follows the Create List Item action. Reason being that while the Create List Item action returns an ID for the new item created in a list (Tasks list in this case), the Task item itself hasn't really been created in the list, and takes a couple of additional minutes to actually appear in the list. Using the Update List Item fails because the workflow tries to update an item that doesn't physically exist in the Task list yet. One solution I found was to use a Pause For Duration action (to pause the workflow for at least a minute) after the Create List Item action and before the Update List Item action. This ensures that there is ample time for the task to physically be created in the Tasks list. I should warn you though that there is a bug in the Workflow Timer Engine, and the workflow can sleep for up to 5 to 20 minutes even if you want to pause it for just 1 minute.
Another solution (that works most of the time) is to add a different step by clicking on the Add workflow step link and using the Update List Item action in that step.
Remember, SharePoint designer is great for rapid workflow creation and for prototyping. It's not perfect. Good luck!
Thanks Adnan, I will try suggestions provided by you and let you know if it is successful
I'm feeling really silly, but I can't get the workflow to pass Step 2's first condition (Awaiting Assignment). The approval processing workflow will create the task to get the Content Analyst using SPD's Collect Data from a User but it appears to freeze at "In Progress" thereafter and won't update anything (e.g., doesn't get to Step 4 Update Workflow).
What am I missing? :)
Point of clarification on my question above:
It appears that my issue comes from the Collect Data from a User action not updating properly so it basically hits an infinite pause. For example, the "from" user/group receives the task, enters the Content Analyst user and hits "Complete Task". What happens is the record gets updated but doesn't change to reflect that it has been Completed.
Any insights?
Well, I believe I may have found at least part of the cause. It appears that SPD's functionality for Collect Data from a User doesn't like to use task lists that are modified from the default (e.g., changing various default field choices/names).
Using a default-created task list appears to solve the problem.
HI Adnan,
PLz help me with this
i have a scenario here- where i have a cost entered and in the Sharepoint designer I want to send the tasks list for approval to User A if cost is less than $100. And if it is more than $100 it will go to user A and then User B if User A Approves it . Now, if greater than $ 300 assign it for approval to USER A , then B(If A approves it), C(if B approves). Basically it goes thru each levels everytime depending on cost. Which option should i use to perform this approval process [Assign a form or Assign task]. I cannot understand which Task actions should I use where I could check the approval and then assign it to another user for approval.
I am not assigning the form to all the users at once but it goes to next level only if it gets approved. What if it gets rejected(for $300) when A approves, B rejects and will not be assigned to C.
I appreciate your help
Thanks
when i go to Go to File > New... > i dont see workflow?? why?
parsa.akbari@ntlworld.com
Thanks for your post. I didn't know that we can build state machine workflow using SharePoint Designer, definitely it will be very helpful for my future projects...without complex code
:-))
Thanks a lot!
Unfortunately I don't think this works any more after SP2.
thanks for your post..
With service pack 2 and in SPD 2010, the recursive execution of the same workflow on item change is not possible. You need to separate the loging into two workflows that can run in a co-recursive manner. See the link ::
http://blogs.msdn.com/b/sharepointdesigner/archive/2009/07/13/service-pack-2-prevents-an-on-change-workflow-from-starting-itself.aspx
I'm a little stuck. I hope you can help
I have a service request site where 1. someone requests a project and it 2. should then get submitted to the project managers.
3. the project manager approves it, assigns resources 4. possibly send it for compliance review.
i want to collect data from the managers that are already designated in the original service request.
I'm getting stuck on step 2
will you please elaborate
"Assign document to Analyst" in detail.what kind of GUI you provide at this satge.
This approach is correct but is not working because even if you update the list at the end of the workflow it does not trigger again. To solve that issue I duplicated the workflow and set the duplicate workflow to execute when the list is updated. They take responsibility in turns to handle the states. To duplicate a workflow, create a new workflow for the same list that works only when a item is updated. Add one step with one dummy condition (such as 1=1) and a dummy action (such as log to history) and save it. Then open the original workflow as XML (!), copy the content, open the duplicate workflow as XML and paste it. Do the same for .rules files.
Of course do not forget to publish the duplicate workflow! Meanwhile note that the duplicate workflow will use the same task pages created by original workflow.
Post a Comment