Email: info@zenconix.com

Change Task Edit form of sequential workflow in SharePoint 2010 using visual studio

Published on: 04/6/15 12:51 PM

Category:SharePoint 2010 Workflows SharePoint Workflows Tags: , , , , , , ,

Hello Reader 

Condition is if you want to change the task edit form the workflow using visual studio in SharePoint 2010, then you can have several options 

1) Change task list’s schema.xml, change edit form tag. Just add application page and change the path of EditForm Url

 

 

[code language=”css”]

<Forms>

<Form Type=”DisplayForm” Url=”DispForm.aspx” SetupPath=”pages\form.aspx” WebPartZoneID=”Main” />

<Form Type=”EditForm” Url=”EditForm.aspx” SetupPath=”_Layouts\SharePointProject4\myEditForm.aspx” WebPartZoneID=”Main”/>

<Form Type=”NewForm” Url=”NewForm.aspx” SetupPath=”pages\form.aspx” WebPartZoneID=”Main” />

</Forms>[/code]

 

2) Another way that we have to change the task edit form, is by writting some code in workflow

I have written code by which I can directly change the task form of the workflow 

Code is written on Create Task method invoking function.

 

workflow-changeTaskEditForm

 

[code language=”css”]

public void createTask1_MethodInvoking(object sender, EventArgs e)

 {

    createTask1_TaskId1 = Guid.NewGuid();

    createTask1_TaskProperties1.Title = “Test Title”;

    createTask1_TaskProperties1.AssignedTo = “i:0#.w|directory\approver”;

    var taskList = workflowProperties.TaskList; 

    var wfContentType = taskList.ContentTypes[“Workflow Task”];

    TaskTitle = workflowProperties.Item[“Title”].ToString();

    wfContentType.DisplayFormUrl = “_Layouts/SharePointProject4/myEditForm.aspx”;

    wfContentType.EditFormUrl = wfContentType.DisplayFormUrl;

    wfContentType.Update();

    taskList.NavigateForFormsPages = false;

    taskList.Update();

 }

[/code]


Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts