Tuesday, August 12, 2008

Secondary workflow

So what is it and how does it help to have a secondary workflow?

To better depict the picture I'll start with the following scenario: there is a complicated document management system with many approval workflows etc. one of many workflows is triggered by a document upload, the workflow type is determined by some of the metadata of the document. when an approval task is created by "collect data from user" action in the SPD workflow creation, the approval task should indicate the type of the document and some additional metadata of the document such as if approval of the document is urgent, due date for the approval, etc. (you finish the list :-) All of this information is indicated by end-user during the document metadata input. But... when the task is created the next step of the workflow is not executed until user completes the task, even if I put "update item" action in the next step to update metadata of the task with document's metadata, it will do so only after the task is completed, which completely defeats the purpose of this step.

Secondary workflow to the rescue…..

When you create a workflow on the tasks list and start it on item creation.  You will update the metadata of this task with the metadata of the document and reference the document by using "Tasks:Workflow Item ID"

In the long run as soon as the task gets created it will update itself with the document metadata by finding the doc based on the following criteria "document library: ID" = "tasks: workflow Item ID"

This is applicable in any scenario where you want to reference the item that originated the workflow that had created the task.

2 comments:

Anonymous said...

Hello Natalya,

I am trying to achieve a similar result but I want the task to expire after a certain period.

I currently have two workflows, the first one will do some validation then start a "Collect Data from User" task.

The second workflow monitors the Tasks list and will check if the new task has been created by Workflow1, if so then it will setup the expiry date and pause until the date approaches.

If the user completes the task then control will go back to Workflow1 but if they don't complete it, the expiration time will get triggered and I set the status to "Deferred" and the completion percentage to 100%. The problem is that control will not be returned to Workflow1 and my guess is that this is due to the Outcome not being "Completed".

Is there a way to force the Outcome to be "Completed" from within the Sharepoint designer workflow?

Thank you.
Zaid

Unknown said...

Hi all,
Have you found an answer for this ?

I'm exactly in the same situation and i don't see a way to force the Outcome field to be completed.

Regards

Lionel Bruley