Symptoms
Getting error messages in workspace during a workflow running on a SharePoint document library to automate a review and approval process. Specifically when the workflow updates document metadata.
Document Review Approval WorkflowSubmit Document for Review and Approval Workflow Document Review - Simon Tst 5.docx
Update Document Status - Set Approvers Service: projectzonetst_tnad_tasnetworks_com_au
Service Guid: 65becd7b-b98a-48d4-b8d1-f4e4ff5a2749 Severity: Error Error Message: The file Governance/Simon Tst 5.docx has been modified by i:0i.t|00000003-0000-0ff1-ce00-000000000 on 05 May 2015 11:16:46 1000. InnerException Message:
I have built a workflow that automates a document review and approval process. The originator manually starts the workflow off on a document, they setup 1 or many reviewers and approvers. The document library has a field for document status which is updated throughout the workflow. There are edit permissions given to the document for the reviewers during the review stage, and likewise for the approvers during the approve stage.
Diagnoses
It appears that in the Set Approvers activity, you are using two SmartObject calls to SharePoint.
The workflow sends the Update Document Status event, then the Remove Reviewer Permissions event.
When the first event hits SharePoint, SharePoint puts a lock on the document.
Because the SmartObject has no knowledge of what status SharePoint is in, it tries to send the second event while the lock on the document is still active. Hence, we get the error message.
Resolution
We need to get a delay between the Update Document Status and Remove Reviewer Permissions events.
Create a new action (Set Approvers 2) and move the Remove Reviewer Permissions event to that action.
(paths between the actions will also need to be adjusted).
For safety, it may be a good idea to add a delay in the start rule of the new action (5 minutes). It is probably overkill, but in case the SharePoint Server is under heavy load, it should handle it ok.