11

I am trying to edit the form that appears when I edit one of my tasks in SharePoint 2010. I currently have a Workflow with an approval process. I believe I can get to the relevent form for my Workflow task (Workflow > Open task list > Forms > EditForm.aspx) however I am unable to edit the form. Am I looking in the right place, or going about this in the correct manner?

4 Answers 4

12

I believe that the EditForm.aspx you are referring to (Workflow > Open task list > Forms > EditForm.aspx) is for the standard tasks in the task list. Workflow tasks, though they are in the same list, operate a little differently.

Firstly, what type of workflow is it?

  1. Browser
  2. SharePoint Designer
  3. Visual studio

Workflow tasks created by the approval workflow, are based on the approval task content type. This content type has a different edit form, normally:

_layouts/WrkTaskIP.aspx?List={List}&ID={Item}&ContentTypeId={ContentType}

What type of change do you want to make to the form?

If you want to add an extra web part outside the form, then you will have to copy the WrkTaskIP.aspx page, and make your own custom one. Then set the EditFormUrl on the approval task content type to be your custom page. Beware all approval tasks in the site collection will get this new form.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontenttype.editformurl.aspx

If you want to add some extra data display fields to the actual form, then you have to open the workflow in sharepoint designer. When you select the workflow, you should see a Forms box on the summary page. Use InfoPath to edit, save and publish the form, and republish the workflow.

If you want to add some extra data capture fields, then you may have to add them to the content type.

Worst case, you will have to build a custom workflow with a custom approval task content type in visual studio. (I have done this, and the amount of effort was not worth it in my opinion, when upgrading that particular component to sp2010 i drop the customization and handled it another way)

2
  • I found many insightful and new things on your reply. Is it possible to put extra field in to SharePoint Workflow Content Type? so i can collect the data from user while approve or reject with out creating new ASPX form ? SP.Murugesa Pandian.,
    – user4838
    Sep 16, 2011 at 9:16
  • This is Great.. How can i hide the delete button displayed in this edit page. Any help is highly appreciated Oct 28, 2013 at 13:20
3

This is a bit tricky. You can edit the View page for a task pretty easily (that is the first one that comes up when you click on a task list). When you open it, you see some generic labels and text boxes. The page is actually built from an enumeration at run time. You can use the Insert ribbon at the top to drop your own Data View Web Part under the generic form (then hide the generic form rather than deleting it). Once you've added the DVWP, you can use the Add/Remove Columns button at the top to display the columns that you want. Note: In the Advanced Settings of the list settings for the task list, you can disable the task list from opening up its forms in a dialog. Full screen seems to work better with the task lists as they have a lot of data on them.

Now the tricky part. When you hit the edit button on the display form, it actually takes you to another form (an approval form) in the workflow folder. You can get to that form from the workflows section in SharePoint Designer, but SharePoint Designer isn't fond of you modifying it. I'm not sure if you needed to modify that one also or not. If so, approach it cautiously.

I'd make a backup copy of any of the forms before you modify them.

2

This article describes doing it "the advanced way" in Visual Studio, which gives most control: http://www.codeproject.com/Articles/195348/SharePoint-2010-State-Machine-Workflows-with-Custo

It is not 100% intuitive, but right elements are there.

1
  • 1
    Please don’t add just a link as answer to a question. If the link breaks, the answer you provided will not be useful for future visitors. Provide an answer of your own and use the link as reference. If needed, you can block quote the content from your link. More information is found in our help center, especially How do I write a good answer
    – Benny Skogberg
    Feb 9, 2017 at 7:58
0

Here is my code to customize the Task form: Set the DisplayFormUrl to my application page. (You have to use visual studio however)

var taskList = Web.Lists["Tasks"];
var wfContentType = taskList.ContentTypes["Workflow Task"];
wfContentType.DisplayFormUrl = "_Layouts/MyFeature/MyWorkflowTaskForm.aspx";
wfContentType.EditFormUrl = wfContentType.DisplayFormUrl;
wfContentType.Update();
taskList.NavigateForFormsPages = false;
taskList.Update();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.