One of the little annoyances with SharePoint workflows is that tasks often open in a display-only mode by default, especially when you are following an email link. The extra click needed to place the task in "Edit" mode causes confusion and wastes time.
In SharePoint 2007 and 2010, you could get around this by customizing the task URL in a notification email, or by having users use the "Open this Task" feature of the Outlook client. Unfortunately, neither of these options work with 2013 workflow tasks. So I came up with a quick little trick to get around the issue. It is just a custom display form that secretly redirects to the EditForm. This code is tested with SharePoint 2013 and Office 365 / SharePoint Online.
One Click Approval for SharePoint 2013 Tasks:
- Open the task list in SharePoint Designer and create a new List Form
- In the Create New List Form window, set the Filename as “RedirectToEditForm”, the type as Display, and check “Set as the default for the selected type”. Also pick your Workflow Task content type.
- Open the Form in Designer so that the code is displayed, then click the “Advanced Mode” button in the ribbon bar. This will open the entire page for edits.
- Insert the following javascript directly after the line <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> (this is around line 15)
<script type="text/javascript">
<!--
var origUrl = window.location.toString();
var editUrl = origUrl.replace("RedirectToEditForm","EditForm");
window.location = editUrl;
//-->
</script>
- Save the form, accepting the change from the site definition.
That is it! Now whenever someone opens a task, the EditForm is automatically displayed and only one click is needed to approve or reject the task. The redirection should occur before the first form renders so end users won’t notice what is going on.
Contact Us
For more tips and tricks, check out some of our other DMC SharePoint Blogs.
For help on implementing your own workflow processes with SharePoint, please Contact Us. We would welcome the opportunity to make your workflow project successful.
Learn more about DMC's SharePoint workflow services.