2
votes

I want to create state machine workflow using visual studio where on edit of assigned task user should get approve-reject button. Currently I am getting % Completed option.

When I tried to assign task using SharePoint Designer 2013 my edit task was redirected to "_layouts/WrkStat.aspx" page, in which Approve/Reject buttons are there. But when I tried it with visual studio it is redirecting to EditForm.aspx page where I am not getting Approve/Reject buttons.

This is my element file of workflow.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Workflow
    Name="SMW-WF"
    Description="Approve Reject Leave Request"
    Id="GUID"
    CodeBesideClass="SMW.WF.WF"
    CodeBesideAssembly="$assemblyname$",
    StatusUrl="_layouts/WrkStat.aspx">
    <Categories/>
    <MetaData>
        <AssociateOnActivation>false</AssociateOnActivation>
    </MetaData>
</Workflow>

Can anyone guide me how can I redirect my edit task page to _layouts/WrkStat.aspx page or add approve/reject button to editform.aspx page of task.

Thank you. :)

1

1 Answers

1
votes
  1. Add an application page to the state machine workflow and name it customTaskForm.aspx. You can do all your customization to the task form in here.

  2. Add a content type to workflow project. The parent content type should be Workflow Task(0x0108). The element.xml of content type should be something like this: enter image description here

Note: Replace <> with your workflow project name.

  1. In workflow designer, add 'CreateTaskWithContentType' from the tool box. In the respective method, you have to provide the content type id may be like this: this.createTaskWithCT_ContentTypeId1 = "GUID of The Content Type"(Get it from the element.xml of the content type)

Good luck..