Using If in a workflow - Workflow Toolbox

Within the toolbox is a group of tools that help control the workflow's direction and flow.

What is the IF tool used for?

The IF tool can be used to check if a particular condition is true and will then allow you to branch your workflow depending on the result. 

For example, if you are running a legal matter and the subtype is 'Dust Disease', we may want to follow one path for the workflow, but if the subtype is 'Slip', it may follow a different one.

Pre-Requisites

Before you use the IF clause, you must put the item(s) you want to check into a variable. 

For example, if you are checking the subtype, you may want to put the subtype of the matter into a variable (you could use the Load Work Item tool to do this).

If you call your variable subTypeId, you must refer to this as ctx.subTypeId in the IF clause. 

 

Configuration

Action Name A descriptive name for the action indicating its purpose
Condition

The condition that is being checked.
Some examples:

  • ctx.isLitigated === true  this is checking a boolean field.
  • ctx.freeholdLeaseholdValue == null this is checking the freeholdLeaseholdValue is not empty (null).
  • ctx.litigationType === 'roiCircuit' this is checking a string.
  • ctx.isLitigated === true || ctx.litigationType ==='roiCircuit' this looks for whether litigated is true OR litigation type = roicircuit.
  • ctx.isLitigated === true && ctx.litigationType ==='roiCircuit' this will check for is litigated AND litigation type. 
  • ctx.freeholdLeaseholdValue.includes("Leasehold") this is checking if a string includes the phrase Leasehold - note this is case-sensitive.

=== will check both the value and the type, or you can use == which will only check the value. 

Syntax 

== Equals checking values only
=== Equals checking values and type
!= Not Equal too
&& And
|| Or
.includes Includes text e.g. ctx.freeholdLeaseholdValue.includes("Leasehold") 
Label Defines the label the output that will be shown on the if clause (the place you can link your lines to on the workflow diagram).