- 18 Nov 2024
- 6 Minutes to read
- Print
- DarkLight
- PDF
Add conditional Workflow elements
- Updated on 18 Nov 2024
- 6 Minutes to read
- Print
- DarkLight
- PDF
Conditional elements enable you to control how a Workflow behaves based on customer inputs. For example, present different versions of a contract to customers according to the location in which they live, or end the session for underage customers.
This article explains how to add the following types of conditional elements to a Workflow:
Switch
A Workflow switch creates a junction in which customers are taken down one of several paths according to the condition for that path. The system checks these paths in the priority order you set, and the first condition to be fulfilled determines the path the customer will follow. If none of the conditions are met, the customer follows a default path.
For example, an insurance plan Workflow could create different paths according to age and marital status. The path conditions could be as follows according to the order in which they are checked:
Under 18 - this path requires a parent or legal guardian to sign a document.
Over 65 - this path contains certain favorable terms for seniors
Family - this path offers family plans for a couple or family with children
In all other cases - this default path offers a plan for only one person who is between the ages of 18 and 65
The following instructions explain how to create a switch with simple one-line conditions. To find out more about adding more complexity to the switch conditions, see Setting conditions in Workflows.
To add a switch to your Workflow:
Drag the Switch element from the right pane.
The Condition Switch dialog opens.In the left pane, enter a name for the first condition, for example Under 18.
Enter the condition statement. For example, the Attribute age is less than 18.
If required, in the left pane, click + to add and define additional conditions.
The last condition is always reserved for all other cases - if none of the other conditions are met.When you are finished defining all your conditions, close the Condition Switch dialog.
Connect all switch conditions to the relevant next steps in the flow.
Drag a connector line from the Switch to the step you want the customer to proceed to when the condition is met.
In the Select Condition dialog, select the condition you defined and click Connect.
The first path on the switch is completed.
Continue connecting until all conditions are connected.
To change the order of the how the conditions are checked:
Select the switch and click the edit icon.
The Condition Switch dialog opens.
In the left pane, hover over a condition and drag it the required position.
To delete a switch:
Select the switch element and click the delete button.
Condition Hub
You use a condition hub when you want to share a set of documents with your customer based on multiple conditions. Every condition in the hub is evaluated separately, regardless of the result of the previous condition. For each condition that is met, a document is shared with the customer.
For example, assume you have a terms and conditions agreement made up of different parts that vary according to State law and age of the customer. The terms and conditions that you want to display for a 56 year old person living in California may be different to those that apply to a 17 year old person living in New York.;
Assuming each PDF document contains a different part of the agreement, you can set specific conditions for each document, so that customers will only see the parts that are relevant to them. At the end of the Workflow, the documents are combined into one PDF that the customer can review.
Note
The result of each condition can only be a PDF.
You can only assign one document to each condition.
To add a condition hub to a Workflow:
Drag the Condition Hub element from the right pane. The Condition Hub screen opens.
Enter one condition for each document that you want to share.
In the left pane, enter a name for your condition, for example Lives in California.
Enter the first condition statement. For example, the Attribute state_address contains California.
You can combine multiple condition statements using And / Or logical operators. You can also create more complex conditions by including some condition statements in parentheses. For more information about working with conditions, see Setting conditions in Workflows.
To add a new condition, click the Add button and repeat the above steps.
After you have added all your conditions, close the Condition Hub screen.
Connect each condition with the document you want to share.
Select the condition hub element and drag a connector line to the document you want to share when the condition is met.
In the Select Condition dialog, select the relevant condition and click Connect.
Repeat these steps for all the conditions you defined until each condition is connected to a document.
The connection indicator next to each condition indicates whether or not the condition is connected to a document.
Connect the condition hub to the next step in the flow.
After all the conditions are checked, the users move to the next step in the flow, regardless of the results of the conditions.
Select the condition hub element and drag a connector line to the next step in the flow, for example a form.
In the Select Condition dialog, select Continue to and click Connect.
To delete a condition hub, select the condition hub element and click the delete button.
Function
You can insert a function into the Workflow and assign the result to an Attribute. For example if you require information in your Workflow that is not provided directly by the customer, you may be able to derive that information from other data, by using a function. For example, you can use a function to derive the age of the customer by calculating the difference between the customer's birth date that they entered in a form and the current date. The resulting Attribute can be used in a subsequent step in the flow. For example, the Attribute might populate a field in a PDF or be used as a basis for a conditional step.
To add a function:
Drag the Function element from the right pane. The Create New Function dialog box opens.
Functions can include Attributes and system values.
To insert an Attribute into the function, click the Attribute button or the @ character.
To insert a parameter into the function, click the parameter button or type the # character.
Enter the function in the Function expression box.
You can enter a simple arithmetic function or a built-in function, or a combination of both.
Simple arithmetic function- For example, assuming you want to calculate the final price on a discounted item, you could write the following simple arithmetic function based on the list price Attribute and the discount Attribute:
@list_price - @discount
Built-in function - To insert a built-in function, click the Add Function button and select the relevant function.
Lightico provides the following built-in functions:
Concat - Allows you to concatenate a combination of Attributes and text strings. You can include up to 7 elements, separated by a comma. Text strings should be enclosed in inverted commas ("). For example you could concatenate the first name and last name into a full name:
concat( @first_name ," ", @last_name )
Datediff - Allows you calculate the difference in seconds between 2 dates. For example, you could derive the age of the customer by calculating the difference between the customer's birth date and the current date and then converting the seconds into years:
(datediff( @birth_date , #currentDate )) / (60*60*24*365)
In the Bound Attribute box, select the Attribute to which you want to bind this function.
To edit the function, select the Function element, and click the edit button.
To duplicate or delete the function, select the function element, click the 3 dots to open the context menu, and select the relevant action.