Using SharePoint Document Approval Workflows – Working with metadata and custom content types
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.
Posted by Swati Shrimali
Swati is Microsoft Certified Professional with 10+ years of project experience. She takes care of requirement elicitation, architecting solutions, managing projects and teams, and ensuring efficient project delivery. She has extensively worked on technologies including – SharePoint, EPM, ALM, .NET, Office 365, PowerBI and social integration with enterprise systems. She is currently working as Solution Architect and also leading the Business Dynamics – PPM COE in Advaiya.