Skip to main content
The IF activity lets you create workflow branches and use classification results and field values to select the next activity. A good example of when an IF activity needs to be used is a flow that contains a classify activities and different extraction activities for documents with different classes. In this case, the If activity acts as a condition for the following: if the document is classified into type A, it will be processed using extraction activity 1, if the document is classified into class B, extraction activity 2 will be used. To set up an IF activity:
  1. Add an IF activity to the document processing flow.
  2. In Case Condition, select an activity or the end of the flow as a branch for the flow. Click the settings icon next to the selected condition and use the dialog that will open to write a script that describes the branch condition. Click Save.
  3. In Else Condition, select an activity or the end of the flow as the other branch. If the Case Condition you specified is true, the previous branch will be selected in the flow. Otherwise, the branch specified in Else Condition is selected.
You can use the sample code below to create your own script:
function checkClass() {
for (var i = 0; i < Context.Transaction.Documents[0].Fields.length; i++) 
{ if (Context.Transaction.Documents[0].Fields[i].Name === 'class' && Context.Transaction.Documents[0].Fields[i].Value === 'resume')  return true; }
  
return false;
}
checkClass();
Note: The CurrentDocument property is a deprecated. Always points to the first document in a transaction. To get all transaction documents, use Context.Transaction.Documents.