Working with Conditions
Last updated
Last updated
Conditions allow to apply some logic conditionally.
There are 3 types of conditions you can use:
Query - use query when you need to work with SF objects.
Formula - use formula when you need to work with Source object, Variables, Current user, System data or Organization Settings.
Call Apex - use call apex if you need to apply some complicated logic, which can't be applied with above options.
Select Query condition type and click "Add Condition" button:
Select field name
Select an operator (this picklist will be enabled only if select field, and it's options are depending on field type)
Select Type of value (static Value, selectable Field or a Formula expression)
Fill or select a value:
Value - some static value (controls in "Value" column depend on field type, e.g., there will be a text input for strings, checkbox for boolean, date and time pickers for DateTime, etc).
Field - select a field from the same object (e.g., if you want to add their equality to conditions)
Formula - Merge fields of Context objects, Formulas and calculations
Provide condition logic expression if necessary:
If user does not fill Logic field then all conditions are validated all at once so record that gets validated should meet all conditions.
To use conditions in Logic expression user needs to operate conditions Index values. So {1} will represent first condition in the picture above, {2} will represent second one, etc.
Each condition Index must be enclosed in curved brackets
Following operators can be used when creating logic based on list of indexed conditions:
OR evaluates if at least one of multiple values or expressions is true.
AND evaluates if two values or expressions are both true.
NOT(%expression that you want evaluated%) - Returns FALSE for TRUE and TRUE for FALSE.
( ) specifies that the expressions within the open parenthesis and close parenthesis are evaluated first. All other expressions are evaluated using standard operator precedence.
Creating complex query condition logic
{BR} operator is used to create WHERE part of Condition logic. Everything that goes after {BR} works the way clauses do after WHERE statement in Salesforce Object Query Language. Use SOQL SELECT Syntax after {BR} operator.
{BR} operator must go after base condition logic
Select Formula condition type.
Select Context Object or function and insert to your formula section.
See more on using Context Object at Working with Context objects. See more on using Functions in formula at Functions Library
Select Call Apex condition type.
Select the Class Name in the lookup field.
Enter Parameters in a JSON format.
Your custom Apex Class should implement FLX_KB.KanBanInterfaces.ApiInterface interface.
Note: In Global Action pass required "methodName" and "parameters" params to custom apex when using FLX_KB.KanBanInterfaces.ApiInterface.
For condition with Call Apex type "methodName" parameter should be set to "Rule".
Below is an example of an apex class that is used to execute condition.
Call method should return boolean. If call method returns 'true' conditions will not be met and action won't be executed. With the above setup global action will always execute because we pass string as a "function" parameter value.