How To Create Custom Task Outcomes In SharePoint 2013 Designer Workflow And How To Use It

In a SharePoint 2013 designer workflow, we possibly have only two outcomes by default viz. “Approve” and “Reject”. Here we will see how to create any no of custom outcomes in a workflow. Creating custom outcome is not a straightforward method. I am using a trick to achieve the functionality and have successfully implemented it.

Introduction

In a SharePoint 2013 designer workflow, we possibly have only two outcomes by default,  “Approve” and “Reject”. Here, we will see how to create any number of custom outcomes in a workflow. Creating custom outcomes is not a straightforward method. I am using a trick to achieve the functionality and have successfully implemented it. 

Scenario

You might come across a scenario where you need an additional outcome other than Approve and Reject. For example, something which states the record shouldn’t be approved or rejected yet, it needs some correction or some state where you want to put the task on hold and need to have some discussion offline. I am demonstrating a similar kind of scenario here in this article.

Step 1- Add Outcome Choices in Task Outcome Column.

Go to the list setting of your task list associated to your workflow.

Go to Content types > Workflow Task (SharePoint 2013).

Click on Task Outcome column of Type Outcome Choice

Click on Edit Column and you will see the Approved and Rejected choice values in the column settings.

Add the additional choices you need to add which you want to have as different outcomes and click OK.

SharePoint

With this, I got 4 buttons; i.e., Approved, Need Correction, On Hold and Rejected on my task list form as shown below.

SharePoint

Step 2 - Create Your Workflow with all the necessary tasks

When you create a task in the workflow its desired outcomes are Approved and Rejected, hence the later step where you give condition > {If Variable: outcome equals (Approved / Rejected)}, you get only two options in the dropdown but we need all 4 outcomes for comparison.

SharePoint

Here comes the trick

We know Outcome variable is automatically created when you create the task and it’s of type integer.

So, I created another variable Outcome1 of type integer.

SharePoint

Now, we have to use this variable Outcome1 instead of the one created automatically.

First, replace the variable in the start a task process statement with Outcome1.

Now, one by one go to the condition statement {If Variable: Outcome equals (Approved / Rejected)} and replace the variable Outcome by Outcome1.

On doing this the drop-down will be gone and you will be allowed to enter the integer value.

SharePoint

Here, the integer values are the outcome options in order.

0 = Approved, 1 = Need Correction, 2 = On Hold, 3 = Rejected.

This is how we can differentiate between the 4 outcomes.

For the demonstration, I have created a workflow which looks as shown below. For each outcome, I have used a Step just for better understanding.

SharePoint

Workflow is created and now it’s time to see how it works for additional outcomes.

When the user clicks on the button “Need Correction” or “On Hold” on the task form.

The “Task Status” gets completed.

The “Task Outcome” becomes Need Correction.

The “% Complete” field value is set to 100 automatically.

The workflow ends without error and stopping.

But the workflow “Internal Status” remains “Started hence the instance keeps running, as shown below.

And you see “Workflow Initiated” is just the name of the “Stage”

SharePoint

Hence, in the above workflow you see I have added action Set Workflow Status to Completed for “Need Correction” and “On Hold” outcomes.

SharePoint

Now, when we run the workflow with the changes it executes perfectly and makes the internal status Completed. No Harm!! we can do it as long as it gets the job done.

SharePoint

It works in a similar manner for On Hold outcome.

Now, let’s check for Approve and the Reject button.

SharePoint

It works in a similar way for both Approve and Reject buttons.

Below is the summary of all the tasks created for testing

SharePoint

Tasks 1 and 2 are the tasks for outcomes “Need Correction” and On Hold WITHOUT Set Workflow Status Action which is still “Running”.

Tasks 3 and 4 are the tasks for outcomes “Need Correction” and On Hold WITH Set Workflow Status Action  “Completed”

Tasks 5 and 6 are the tasks for outcomes “Approved” and “Rejected”

Summary

Here, we have seen how to add the column choices, how to create a workflow with the additional outcomes, how the workflow behaves for the additional outcomes, what errors we might face and how to solve them. This is how we create multiple outcomes on the SharePoint 2013 designer workflow.

I hope this article was helpful. Cheers