In this post, I am going to talk about implementing the document approval workflow for a document library which has a custom content type and a metadata property associated. This requirement seems so simple that it can be done with just a few steps:
- User uploads a document in the document library
- Enters the associated metadata properties for the document
- Document is sent for approval to the relevant users
- Once the user approves the document, it is copied to the destination library with all its metadata
- On rejection, the document status is set to ‘Rejected’, and a relevant email is sent to the creator
I followed all the steps and got ready to test it. So, when I tried uploading the first document, I got this error, which continued for all other uploads:
After checking for a couple of scenarios, I realized that SharePoint 2013 workflow gives an error when we implement it on a document library which has metadata associated. This is strange, and has no specific reason as to why.
So, I found out an alternative to use SharePoint 2010 workflow, which works well with document library having metadata.
The approval task process needs to be customized using the customizations described here:
I could develop the workflow successfully using SharePoint 2010 to suit my requirement, but as it’s a workaround, it has the following limitations:
- Configuring Task Approval Process in SharePoint 2010 is far complex than configuration in SharePoint 2013 Workflow
- Using SharePoint 2010 Workflow, ‘call webservice’ activity is not available
- Similarly, the string utility activities are very limited, so you will not get activity like ‘get index of’, ‘find last index of’, etc.
However, a few advantages of using SharePoint 2010 workflow are:
- Ability to capture the task comments from task approval and set it with the document library item to maintain metadata, while in SharePoint 2013 it needs to be done using calling Rest Service
- Ability to customize the behavior of task
Hoping to see a solution for SharePoint 2013 Workflow soon; till then this workaround should suffice. Have any questions? Write to me in the query box below, and I will get back to you.