Automatically open SharePoint 2013 workflow tasks in Edit mode for easy one-click approvals

This article was originally published on July 18, 2018. Product interfaces and features may have changed.

one-click approval

On one of my recent projects, a client asked if it would be possible for the link to a task within a workflow notification email to open the task in “edit” mode instead of “display”. If you’re unfamiliar with SharePoint 2013 task processes built in SharePoint Designer, here’s what their process looked like prior to our change:

  1. Someone submits form
  2. Approval request sent to manager
  3. Manager clicks link in email to open task
  4. Manager clicks “Edit”
  5. Manager clicks “Approve”

They wanted to eliminate step 4 to make the process as easy as possible (one-click after opening link in email). Here’s what we ended up doing:

  1. Open your task list in SharePoint Designer by clicking “Lists and Libraries” from the left nav then “Workflow Tasks”
  2. Add a new form
    new form
  3. Update all fields to match below (name it “OneClick”, set as display type, set as default, set content type to Workflow Task)
    oneclick
  4. Click OK
  5. Right click your new form and select “Edit in Advanced Mode”
    edit file in advanced
  6. Look around line 14 for the line beginning in <asp:Content ContentPlaceHolderId=”PlaceHolderMain”…
    insert javascript
  7. Insert the following script after that line and “Save”
<script type="text/javascript">
    <!--
    var origUrl = window.location.toString();
    var editUrl = origUrl.replace("OneClick","EditForm");
    window.location = editUrl;
    //-->
</script>

Original code on GitHub: OneClickApproval

Click OK for the warning about changing from the site definition

Now in your workflow task notifications whenever there’s a link or reference to the Task URL it will automatically open in “Edit” mode.

Preserved with its original publication date.