The first SharePoint 2010 challenge came while I was working with a Document Library that will store letter and form templates. I want Content Approval one so that document is not available until reviewed/approved. I also want to use a workflow for the notification and ease of use to the end user to provide approval. For my situation I wanted to use an out of the box Approval workflow with the following options:
- Start this workflow when a new item is created.
- Start this workflow when an item is changed.
- Update the approval status after the workflow is completed (use this workflow to control content approval).
- Only the Document requires Content Approval. Folders will be utilized in the Library but do not want them to go through workflow.
As you may have experienced this did not work. The workflow would complete fine but the Content Approval on the Document was not being set. So after reviewing the configuration and more testing I made no progress. So off to the internet to search for answers. I found that out of the box SharePoint 2010 would not update the Content Approval on the document even though you would check the box to have it do so. That check box will only work if you have Versioning turned on for the Document Library and checked the box “Start the workflow to approve publishing a major version of the item” in the workflow configuration. I don’t want versioning. So it looks as though my option is editing the workflow in SharePoint Designer 2010. I am not a developer by trade and know enough to be dangerous but what the heck.
I also ran into issues during the early stages that if you want the Approval workflow to apply to the folders this solution will not work. Anytime the folder is changed/updated (including contents) the workflow will be kicked off.
Some words of warning, if you are working in a Production site be very careful. Also make sure you are working within the site that you want to make this workflow available. This solution took me a couple of times to work out the kinks and multiple restarts. I am working in a developmental environment.
- Open the site in SharePoint Designer
- Find the default “Approval – SharePoint 2010” workflow and selected make a copy and modify
- Entered a new name (here you could also limit the content types when setting up the new workflow)
- Now it opens the workflow to be edited in Designer, Click on “Approval Workflow Task…”
- Under Customization Click Edit Workflow.
- This screen is where you should rename the Task Information Name. Click “Change behavior of a single task”
- Find When a task Completes, the first section is where we will need to add a new task
- Insert the cursor between the two lines. This way the next step will insert in the correct place.
- Insert the Action “Set Content Approval Status”. Now be careful there is also a Set Content Approval Status for Document Set” which I can tell you will not work.
- It should look like the image above. Change the status to “Approved”
- To use within the entire Site Collection you can choose the Publish Globally option.
- Now back to the workflow configuration on the Document Library. Another thing I learned the hard way is that you only want this workflow to apply to Documents, not Folders. Choose Document from the “These workflows are configured to run on items of this type:”
- Click add workflow and choose the new template from the list:
- Also give the WF a name and set the desired options of when to start a workflow.
- On the second configuration page leave the “Update the approval status after the workflow is completed (use this workflow to control content approval).” option unchecked.
- Now the new workflow is ready to go. Submit a new document or edit and existing one(if configured)and you should see the Approval Status is Pending and new workflow status is In Progress.
- Approve the workflow task
- Now when checking the Content Approval and workflow status both show approved.
Yeah mission accomplished. So for my first experience with SharePoint Designer 2010, I am pleasantly surprised I was easily able to modify the workflow without too much difficulty. Please let me know if this worked or didn’t work for your situation or if your situation is different. On to the next task.