How To Create Custom Task Outcomes In SharePoint 2013 Designer Workflow And How To Use 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 that 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 the task outcome column.

  • Go to the list setting of your task list associated with your workflow
  • Go to Content Types> Workflow Task (SharePoint 2013)
  • Click on the task Outcome column of the 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
    Column name-

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

Content type-

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. Still, we need all 4 outcomes for comparison.

Approved-

Here comes the trick

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

So, I created another variable Outcome1 of type integer.

Workflow local variables-

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.

Variable outcome1-

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 that looks as shown below. For each outcome, I have used a Step just for better understanding.

Stage workflow intiated-

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” is 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”
    Initiator-

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

Task need correction-

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.

Initiator complete-

It works similarly for the On Hold outcome.

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

Status workflow intiated-

It works similarly for both the Approve and Reject buttons.

Below is the summary of all the tasks created for testing

Running workflows-

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