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:
- Someone submits form
- Approval request sent to manager
- Manager clicks link in email to open task
- Manager clicks “Edit”
- 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:
- Open your task list in SharePoint Designer by clicking “Lists and Libraries” from the left nav then “Workflow Tasks”
- Add a new form
- Update all fields to match below (name it “OneClick”, set as display type, set as default, set content type to Workflow Task)
- Click OK
- Right click your new form and select “Edit in Advanced Mode”
- Look around line 14 for the line beginning in <asp:Content ContentPlaceHolderId=”PlaceHolderMain”…
- Insert the following script after that line and “Save”
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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.
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.
There is script found to insert after code line 14
The script is at https://gist.github.com/nchambe/874d7b93dd7559fd777b8410076b42f9
There is No script attached and do we have to choice display item form or edit item form.
Works perfectly. Thanks, Nate!!!
There is no script attached
i followed the inscructions and it’s working fine 🙂
thank you very much!