Tuesday, 24 August 2010

How to get approvers user name in workflow?

When you assign workflow task to any group and how would you get task approvers user name? Task list can show only 'assigned to' column which will give you group name only.
You can fetch approvers user name by creating custom List item event receiver for task list. Create Item updated event receiver and add following code...

public override void ItemUpdated(SPItemEventProperties properties)
{
base.ItemUpdated(properties);

SPListItem oListItem = properties.ListItem;
oListItem["ApprovedBy1"] = properties.UserDisplayName;
oListItem.Update();
}

*Note: Create new column for workflow task list. I created new column with ' ApprovedBy1 ' name.

0 comments:

Post a Comment