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?
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?
- SharePoint Designer
- 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:
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.
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)
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.
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.
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();