I am working with SharePoint 2013 and a document library.
After numerous attempts at trying to coax the 2013 workflow process into doing what I needed, I gave up and resorted to a 2010 workflow.
This workflow is triggered by a change in the document, and runs through an approval process, which results in either the content approval or rejection of the document.
During this process, I don't want users editing the document and changing it.
Edit: The workflow, itself, needs to change fields in the item during its process, so it has to be able to check-in / check-out and make changes to the item. (Added 16/12/2014)
The library this workflow is associated with has required check-in / check-out as well as content approval.
What I've tried:
The workflow checks out the document and only checks it in when it's finished.
Issue - the workflow doesn't realise it has the document checked out, thinks there's a lock on it, and stops the process until the document is checked in again.Impersonation step to change the permissions to readonly on the item.
Issue: not only did the permissions stay the same, but I realised by doing that (if it had worked) I would prevent my valid users seeing the draft they were being asked to approve.Event receiver to check if anyone other than the workflow is checking the document out, and stopping them.
Issue: the workflow runs under the user who starts it (e.g. the user who requests the document be published), and not a dedicated workflow account (or even the system account), so I couldn't work out which user account to allow the checkout for.Cancelling the workflow on change (as an almost last resort).
Issue: the workflow itself changes the item by changing properties as it runs. This causes an error, and the workflow just stops, instead of ending the task process, as it's supposed to.
Is there any method of allowing the workflow to do what it needs to, but stopping the users changing the document while the workflow is in progress? Any ideas would be fantastic.