Always Open SharePoint 2013 Tasks in Edit Mode

Always Open SharePoint 2013 Tasks in Edit Mode

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:

  1. Open the task list in SharePoint Designer and create a new List Form

    SharePoint Workflow Tasks

  2. 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.

    SharePoint New List Form

  3. 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.

    Always open EditForm

  4. 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;
  5. 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.





Tested this today. It actually caused my testers to be unable to create new tasks.
# Edil
Thanks for the solution! Worked neat!
# Lysida
I've been looking for a solution so that a user doesn't have to click Edit every time. Now I only need to look for the other issue I have where when a user clicks on the link from their email that they've been assigned a task, it automatically opens the task instead of showing a list of other tasks.

THANK YOU so much!
# Janet
Thanks for the tip! By far the easiest item I've found so far to implement.
# Steve
Thank you so much!
Henry Chen

In Advanced form options
Select the Content Type to use: Workflow Task (SharePoint 2013)

I don't have the "Workflow Task (SharePoint 2013)". The only option is "Item". In this situation, do you have solution for it?

Raphael Santos
# Raphael Santos
Hi Sir, thanks for sharing this. It worked and helped a lot!
# Skhumbuzo
Nice one! worked like a charm!
# Sazesky
Thank you very much for this simple and extremely useful solution. Saved me a lot of time.

Question: I'd like to redirect users to the home page (instead of the workflow task list) after completing the task. I thought of reusing your script in the edit form itself. I want to specify that it change the url after "sourece=" from something like "https%3A%2F%2Fmydomain%2Esharepoint%2Ecom%2FLists%2FWorkflow%2520Tasks%2FAllItems%2Easpx" to something like "https%3A%2F%2Fmydomain%2Esharepoint%2Ecom" . I'd like to know what you think. is there a better way of achieving this?

Thanks again David.
# Alex
Thank you very much, i've been looking for this for weeks.
# Celcius

how frustrating the url to the edit form isn't available OOB or that you cannot get the task ID from within the task either would allow this without code changes but nonetheless excellent work, saved me hours of end user confusions!
# Lee
Hey I saw Dean's comment about the error message Type 'Microsoft.SharePoint.WebControls.UIVersionedContent' does not have a public property named 'script'. - and managed to get the same thing.

If you see this, you made a mistake with where you inserted the script block. Make sure it is after the <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> tag but BEFORE the <SharePoint:UIVersionedContent UIVersion="4" runat="server"> tag.
# Caleb
What a perfect article. Simple, easy to follow steps that get exactly what I want! Thank you.
# Steve
Thanks David. You're the man!!

This has been really bugging me and have tried several options to workaround all the problems and get a workflow approval process which my business users won't throw back at me. The final piece of the puzzle was how to ensure that the Approve Task link which gets emailed out would actually take the user directly to editable version of the task which contains the Approve & Reject buttons. Have spent the last couple of days wrestling with this problem and trying different options, finally found this article and solved that problem in 5 mins
# Gabriel
Sir, thank you for this simple and straight forward solution! You definitely saved me hours of work here, keep up the good work.
# James
Works perfectly - just what I was looking for.
Thanks very much :)
# Gus
Thankyou Very much. Works well and is very simple. :-)
# Allan
Thanks David! It is a simple and easy solution! I spent hours on trying to understand how to get the task ID! Thanks Microsoft...

Anyway, works perfectly!
# Dean
When I try this in SharePoint Online, I get Type 'Microsoft.SharePoint.WebControls.UIVersionedContent' does not have a public property named 'script'. Any idea what I might be doing wrong or how to fix?
# Suresh
Thanks it worked very well
# p
Hi this is really great and works well.
Once I try to hide items from the task form through, something say %complete and status the approve and reject buttons disappear. Any suggestions why this might be happening?

Thanks again!
# Martha
Hi, thank you for this solution. Great!

I wanted to ask, how can i redirect the page to the list page after clicking the approve/reject button?

# BE
Thank you! I have been looking high and low for a solution like this. It works as you advertised!
# Rajasekhar
Excellent work, you saved lot of time for me
Scott Petersen
After 2 hours of trying to get the URL formed in the Workflow Email using the ID (where the Q@#$$% is the ID of the Related Task?????), your workaround worked perfectly! I can't believe Microsoft doesn't provide either the Task ID in a variable for use in the Workflow Task email or this redirect functionality OOTB.
# p
Thanks sooooo much. Been looking for a solution for this everywhere!
Sam Karuna
# Sam Karuna
Hi Man,
Thanks heaps for this. Worked beautifully.

Keep it up mate.
# Nicaragua
Wow, thanks a lot !

Another one of those classic SharePoint things that should be easy but is insanely difficult. Actually it was easy in 2010 so why they took away those features is beyond me.

Anyway great work, most appreciated.
# Shanelle
Thank you, thank you, thank you!! I've been looking for a way to do exactly this and I'm so glad I came upon your blog. It worked like a charm!
# Manel
That works perfectly !!

What I would like no know is How could I show the Approved and Rejected buttons. They are hidden I don't know why. At the begining they were in the form.

Could you help me?

Thank you so much
Awesome find! Keep up the good work! :)
# Faraz
Very good

Post a comment

Name (required)

Email (required)

Enter the code shown above:

Related Blog Posts