The concept of using conditions to follow a certain program flow is common in software engineering.

There may be a need to test the condition or state of a variable or field value within any flow that you create. Based on the condition value, the execution of the flow will perform a specific action.

The Condition step can be likened to Decision Statements or If Else Statements in traditional programming.

In Synatic, the Condition step provides this function and generally controls the program flow as follows:

  • If the condition is true – the flow performs one action.

  • If the condition is false – the flow performs another action.


Using a Condition Step

The Condition step is located in the Control drawer in the Steps palette. To use a Condition step:

  1. Select then drag the step object to the desired location in the flow.

  2. Add sub-flows for each condition and configure the criteria for each.


Configuring the Condition Step

The Condition Step lets you add a name and a description. Choose a name and description that describes its purpose in your flow.

After saving the step, conditional subflows can be added by clicking on the ⊕ icon on the step:

When you add conditional subflows, you can configure the criteria of each condition. The condition is specified using JavaScript. You can access the record or any part of the processing object. Return a true value to execute the steps in the subflow, or a false value to skip the subflow branch.



Example

A typical example you may use for the Condition step is to send a one-time password either via email or via SMS, dependant on the record value.

A sendEmail or sendSms field is set as true or false for each record in the data file.

To send via Email

You could add the following example code in the condition code block of the first sub-flow:

return input.record.sendEmail===true;

If the record's sendEmail field is true, then the email sending sub-flow will be run.

To send via SMS

You could add the following example code in the condition code block of the second sub-flow:

return input.record.sendSms===true;

If the sendSms field in the record is true, then the HTTP SMS service sub-flow will be run.


Options

There are no extra options for this step.


Advanced Mode Options

There are no advanced options for this step.


Limitations and known issues

None.


See Also

Read about other Flow steps.


Useful Tutorials

Revisit the Getting Started page for a refresher.

Read more about Flow Steps here.

Did this answer your question?