Back

TechnologyJun 12, 2013

SharePoint Workflow Simplified: One-Click Approvals

Chris Griswold

We specialize in SharePoint implementation and customization. We constantly tackle some of the most challenging SharePoint requests our clients can come up with. We have built complex custom web parts, facilitated intricate system integration, and implemented stringent security models across distributed SharePoint farms both on-premises and online. Thankfully, SharePoint has a robust framework which allow us to build and deploy these kinds of complex solutions.

As someone who has spent the last 13 years specializing in building custom solutions with Microsoft technology, I have a special appreciation for tools such as SharePoint and Dynamics CRM which offer a strong alternative to ground-up custom .NET development. These tools save time and money.

One of the most powerful tools SharePoint provides is the workflow and approval engine. The workflow engine provides powerful automation and allows for complex approval processes which allow business users to go beyond simple site content control and utilize SharePoint for business data and document processing and approval.

An Example

Recently a client requested a very simple approval process for a custom SharePoint list.  It should have been easy. First create the list, then create a workflow which kicks off an approval task. That’s it. Unfortunately, that “simple” solution required too many clicks to accomplish. In order to approve an item, someone would have to go through a five-step process:

1)    Open the list item.

2)    Click on the “Workflows” button in the ribbon.

3)    Find the correct running workflow and select it.

4)    From the workflow screen, click on the assigned workflow task.

5)    Finally, either approve, reject, or reassign the approval task.

This process has way too many clicks. Our approver needed to be able to view all of the data in the list item before approving, so simply linking to the approval task from the approval request email was not sufficient. What I needed was a way to allow the approval to happen directly from the list item display screen. A quick Google search didn’t really provide any relief so I had to come up with a way to create a simple approval without building a custom web part.

Increase business process efficiency and collaboration with Microsoft SharePoint

Explore Our Microsoft Consulting Services  →

The Solution

What I ended up with is a simple yet powerful solution which allows for single click list item approval.

1.  First create a Hyperlink field in your custom list. This will be populated later by the approval task behavior inside the workflow with the URL of the approval task form

 

2.  Create a Choice field called “Status” to control and track the approval. The valid choices should be “New”, “Pending Approval”, “Approved”, and “Rejected”

 

3.  Create a workflow associated with the list which starts when an item is created or changed.

4.  Build the workflow logic according to your specific criteria. In this example I have a simple conditional statement which assigns the approval task based on the amount of the purchase order

5.  Make sure to check the “Status” field so you don’t create multiple workflow tasks each time the item is updated

6.  Inside the approval task behaviors populate the “Approval Link” field with the Form_URN of the current task.

7.  You will also want to modify the task behavior to set the item “Status” field to “Approved” or “Rejected.”

 

8.  Now create custom New, Edit, and Display forms so that you can customize the fields which are displayed to the user

9.  By default the SharePoint form will display the entire hyperlink URL on the form. In order to make it more readable, edit the form source code and add some simple text in place of the complete URL

10. On the New and Edit forms you will want to remove the “Approval Link” field altogether

Ready to Test

Now you are ready to test the process. Create a new list item. Once you receive the notification e-mail open the list item in display mode. You should have a hyperlink on the form which will take you directly to the approval task. Since you are still using all of the out-of-the-box approval workflow functionality, users who are not the assigned approver will not have access to complete the approval task.

And now the approval is complete. By implementing this simple solution you maintain the robust functionality of the SharePoint workflow and approval process while greatly reducing the amount of work a user must go through to both approve an item and view the approval status of that item.

Other Considerations

You might also consider adding some simple JavaScript to the edit form to lock the fields down when the status is “Approved”. This will ensure the data integrity of that approved item without complex security configuration. I used a content editor web part to include the following javascript on the edit form. The script uses jQuery to disable all the fields on the form, hide the save button both in the ribbon and on the form, and display a message to the user explaining why the form is read-only.

Also, this example assumed that once each new list item was created it was instantly ready for approval. Your scenario may require that the item be created and later updated before submitting for approval. In this case you could create a yes/no field in your list called “Ready for Approval” and hide it on the edit form. Add a second “Save” button to your edit form and call it “Submit for Approval”. Use JavaScript to set the value of the hidden “Ready for Approval” checkbox to “checked” when this new button is clicked.  Then inside your workflow add logic to only start the approval when the “Ready for Approval” field is “Yes.” Now your user can create a list item, save it, and come back to it later to initiate the approval process.

Custom SharePoint Solutions

There you go—a simpler process for the client. That’s just one example of the kind of custom SharePoint solutions we offer. If you need SharePoint to be easier, let’s talk. Drop us a line or read more about our SharePoint solutions.

Looking for more great tips on SharePoint, please contact Credera at info@credera.com or send a tweet to @CrederaMSFT.