SharePoint Designer: Get account details of the user who initiated the workflow using OOB Workflow Activities - SharePoint Development & Administration + InfoPath

Sunday, January 24, 2010

SharePoint Designer: Get account details of the user who initiated the workflow using OOB Workflow Activities

Get account name of the user who initiated / triggered a workflow using OOB SharePoint Designer Activities:
The ability to access the account details of the user who started a workflow in Sharepoint is not supported when developing workflow using SharePoint designer and OOB workflow activities. The User data type allows selection of the User who created the item, but not the user who initiated the workflow. Using the Modified By field will return the user who made the most recent changes to the document/list item or meta data, but may not be the user who initiated the workflow. For example, if a workflow is used to set the approval status of a list item or document with content approval enabled is initiated, the user who published a major version of the documnent (submit for approval) will be the user who initiated the workflow regardless of who made the most recent changes to the document.

A number of solutions relating to this issue / limitation are available, including a workaround solution using OOB workflow activities and SharePoint designer explained below:

How to get the account name of the user who initiated a workflow using OOB workflow Activities and SharePoint designer:

1. Create/modify item in secondary list.
This action will be executed using the credentials of the user who initiated the current workflow. Once the list item from the secondary list has been created or updated, you can then retrieve the Creaded By or Modified By user.

2. Pause, then store the user who created/modified the secondary list item in a Workflow variable (string: "DOMAIN\user").
After the secondary list item has been created or modified, you can store the value of either the Created By or Modified By fields of the secondary item to get the account name of the user who initiated the current workflow. Note that you may need to configure the workflow to pause for 1 minute after creating or modifying the secondary list item, as it takes a few seconds for the account details to become available after creating or modifying the item.

3. Use the value of the workflow variable.
Once you have stored the user who started the workflow in the workflow variable, you can then use the value when setting the Assigned To, email recipient or any other field that uses the user account data type.


Related:

In sharepoint designer’s workflow editor how do I get the workflow initiators username?
"In Sharepoint designer's workflow editor I wish to retrieve the username/name of the work flow initiator (i.e. who kicked it off or triggered the workflow) - this is relatively easy to do using 3rd party products such as Nintex Workflow 2007 (where I would use something like {Common:Initiator}) - but I can't seem to find any way out of the box to do this using share point designer and MOSS 2007."

Share this article:
Stumble This Delicious
Delicious
submit to reddit
Facebook
MySpace
MySpace

2 comments:

trigger said...

How can i get the details on the user who approved the workflow?

Daniel said...

You should be able to use value in the the Last Modified field of the approved item or workflow task if applicable, as the item will be modified by the approver once the approval status has been updated.

Post a Comment