SharePoint 2013 App: Workflow with Custom Task Outcomes


In SharePoint 2013, there are many scenario in which use want to customized task form based upon business requirement. By default SharePoint provides “Approve” and “Reject” button at the bottom of your task form. So In this blog post I will explain you how we can create our own custom button for the workflow task form

 

By performing some simple steps we can achieve the functionality to create custom button at the bottom of task form.

Step 1: Open Visual Studio 2012, Create new project by selecting Apps for SharePoint 2013 and select the “SharePoint – Hosted” apps and click on finish.

 

image

 

Step 2: Create a new site column with name “CustomTaskOutCome” of type OutcomeChoice.

 

image

 

Step 3: Create Custom Content type and inherit from task as per shown in below screen

 

image

 

Step 4: Now we need to add the “CustomTaskOutCome” site column and exiting “WorkflowInstanceId” field to the newly created content type.

 

image

Note: OOTB SharePoint workflow task content type is made up of these field and inherit from task content type.

 

Step 5: Create an Custom list instance based on existing Task list template as shown in below screenshot.

 

image

 

Step 6: To make our custom content type to be available for the list we need to add the content type binding to the list instance. So that at the time of list creating content type will automatically attached to list.

 

image

Step 7:  Now we need to create the workflow so that we can perform action based upon our custom task outcome.

 

image

Step 8: Select the type of workflow as a list and click on Next.

 

 

image

Step 9: Provide the name of list where we need to run the workflow. Also make sure Task list will point to list which we have created and select finished.

 

image

Step 10: This is very important point because we need to attached the task activity to our custom content type.

  • ContentTypeId: This should be the id of content type which you have created.
  • OutComeFIeldName: This should point to your custom site column which you have created.

 

 

image

Step 11: Now we need to deploy the solution to our O365 site. After deployment we need to add new item to custom list to run the workflow. Workflow will create the task and assigned to user.

Step 12:  Once task is created and edited by user. You will see there will be three button

image

 

So you will see in below screenshot that workflow is acting upon custom column.

 

image

Hope this will help.. 🙂

Comments (4)

  1. Mike Hatheway says:

    Is there a way to update the Outcome column in the Workflow History?

  2. steps are missing kindly put complete setups

  3. R0n says:

    Where did you get 'WorkflowInstanceId' from?  Is that a hidden step that is not shown?

  4. fahad says:

    Hi does it apply to 2010 as well

Skip to main content