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

1–2 minutes

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>

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.


Discover more from Nate Chamberlain

Subscribe to get the latest posts sent to your email.

7 responses to “Automatically open SharePoint 2013 workflow tasks in Edit mode for easy one-click approvals”

  1. Shalee Avatar
    Shalee

    Mine will not allow me to edit. I right click and it shows nothing, and if I click into it, the advanced options is not able to be clicked.

  2. Alem Avatar
    Alem

    There is script found to insert after code line 14

    1. Alem Avatar
      Alem

      There is No script attached and do we have to choice display item form or edit item form.

  3. Craig Giordano Avatar
    Craig Giordano

    Works perfectly. Thanks, Nate!!!

  4. SP_Developer Avatar
    SP_Developer

    There is no script attached

    1. Hadiat Allah Chouai Avatar
      Hadiat Allah Chouai

      i followed the inscructions and it’s working fine 🙂
      thank you very much!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Nate Chamberlain

Subscribe now to keep reading and get access to the full archive.

Continue reading