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.
Step 2: Create a new site column with name “CustomTaskOutCome” of type OutcomeChoice.
Step 3: Create Custom Content type and inherit from task as per shown in below screen
Step 4: Now we need to add the “CustomTaskOutCome” site column and exiting “WorkflowInstanceId” field to the newly created content type.
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.
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.
Step 7: Now we need to create the workflow so that we can perform action based upon our custom task outcome.
Step 8: Select the type of workflow as a list and click on Next.
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.
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.
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
So you will see in below screenshot that workflow is acting upon custom column.
Hope this will help.. :)
Comments
Anonymous
May 29, 2013
Is there a way to update the Outcome column in the Workflow History?Anonymous
August 28, 2013
steps are missing kindly put complete setupsAnonymous
October 06, 2015
Where did you get 'WorkflowInstanceId' from? Is that a hidden step that is not shown?Anonymous
March 23, 2016
Hi does it apply to 2010 as well