Sakhile Mkhwanazi
Sakhile Mkhwanazi

Reputation: 1

SharePoint document approval workflow, modified and approved by fields

I working on a SharePoint document approval process and here is the scenario: A document is uploaded in the document library, and approval process is initiated. A task is created and assigned to a group (Active directory group) where only one group member can complete the task. What is required is the modified by and approved by fields to display the name of the user who completed the task and not the group name that the task is assigned to.

1) I have tried the out of the box workflow, and if displays system account as the user who completed the task. 2) I have tried SPD approval workflow, and it displays the group name assigned to. 3) I have tried VS sequential workflow :

With VS workflow, I’m able to set the correct user to the two fields (modified by and approved by) and as the last step I need to set the approval content status as follows:

item.ModerationInformation.Status = SPModerationStatusType.Approved; (if approved)

But this runs with system account permission and not the current user, so it resets the field approved by back to system account, and if I swap the sequence of my steps and set the content status first then update the fields last, obviously I’m doing a modification on the item so the content status changes back to draft.

Is there a way I can run this item.ModerationInformation.Status = SPModerationStatusType.Approved; under the current user? Or any way I can achieve my goal?

Upvotes: 0

Views: 4266

Answers (1)

Kevin W. Lin
Kevin W. Lin

Reputation: 31

I would suggest leaving the system columns alone and creating a completely different set of columns for your purposes.

So Create the columns: "Item Modified By", "Item Approved By"

Then write the current user to these fields.

Lastly, remove the system generated "Modified By" and "Approved By" from the default view and replace them with your "Item Modified By" and "Item Approved By" columns.

Upvotes: 0

Related Questions