There are several processes that can use decisions, such as:
- Approvals—Determines which approver is required to progress a workflow.
- Messages—Determines which message template should be used.
- Workflow—Determines which transition a workflow should take.
Similar to logic blocks, each decision is built over a table, and has access to the fields stored in the table. These fields can be used as input fields in a decision record. Input fields contain the values you want to use in the decision rules.
Decision rules are a collection of values arranged as if/then rules. If the criteria of a rule is met, then a specific outcome takes place. Decision rules are made up of two key components:
- Rule paths—The criteria that define a certain path that the record can follow. Rules paths are made with the values from the input fields. The values are used in expressions to create the rule concerning them. Rule paths are configured using the fields in the Decision Rules section.
- Actions—The behaviors that take effect when the criteria from the rules have been met. Actions are the outputs of a decision rule execution. The action options that display depend on the decision type. Actions are configured using the Action field.
After you've created a decision, you can reference it in an application record that has the Decision field. Once it is added to an application record, the rules within the decision can be evaluated and executed. Decision rules are evaluated when the record it is associated with is executed, prompting the decision to take one or more actions based on the field values.
Match policy
Every decision needs a match policy to determine the order in which the rules of the decision are checked. The match policy ensures that no overlapping or contradictory rules are satisfied at the same time. The options for the Match Policy field are:
- First—The first satisfied rule in the subtable is followed from top to bottom.
- All—Multiple rules may be satisfied. All satisfied rules are followed, and the actions of all satisfied rules are all executed.
Next Decisions
Use the Next Decision field to define any other decision matrices that should be processed directly after a rule path is followed. When another decision is processed directly after a rule path, then the actions of both the rule and the other decision's decision rules are accumulated and executed together.
When setting up a rule path with a Next Decision, you can optionally change field values in the second decision using change fields. Change fields allow you to choose the field that contains the value you want to change and define then the exact value that you want to use in the Next Decision record. If you use change fields, then the second-run decision has a driver table record with the specified field changed and makes decisions based off of that new value.
Change fields are not saved to the database, they are only used internally while executing a Next Decision.
Approval Decisions
Approval decisions allow you to specify a set of rules that manage approver authority over workflow records.
An approval decision for a record is based on the values of the input fields from the decision record and the values in the approval record. The decision can take the following actions:
Add Approval Group—Add a user group to the list of approvers for this approval.Add Supervisor—Add the supervisor of the user who requested the approval to the list of approvers.Automatically Approve—Automatically approve the record's workflow transition.
Use the Decision field in an Approval & Notification Definitions application record to attach a decision record (from the Decision Builder application) to an approval. When setting up an approval, you can specify a decision record that executes when the approval record is set in motion.
Example
You could create a decision record in the Decision Builder application to specify rules about who must approve purchase orders based on certain values in the purchase order. For example, your company may require these purchase order rules be followed for it to be approved:
- If the user requesting the approval is the CEO, automatically approve the workflow transition.
- If the purchase order type is non-stock, and the requested quantity is less than 10, automatically approve the workflow transition.
- If the purchase order type is non-stock, and the requested quantity is between 10 and 15, add the supervisor of whoever is trying to transition this record to the list of approvers.
- If the purchase order type is non-stock, and the requested quantity is greater than 15, add the user group
Managersto the list of approvers. - In all other cases, add the user group
GeneralApproversto the list of approvers.
To determine the rules you want to create for your decision record, choose the specific system inputs and fields needed in the Inputs section. You can configure this as follows:
| System Input | Input Field 1 | Input Field 2 |
|---|---|---|
User Requesting Approval | ProcurementLineType | PurchasingQuantity |
Next you would use expressions, change values, next decisions, and actions in the Rules section to define the specific rules you want to create. Based on the requirements listed above you would configure the Rules section as follows:
| System Input Expression | Input Field 1 Expression | Input Field 2 Expression | Action | Action Details |
|---|---|---|---|---|
"ceo@nextworld.net" | Automatically Approve | |||
"Non-Stock" | <10 | Automatically Approve | ||
"Non-Stock" | [10..15] | Add Supervisor | ||
"Non-Stock" | >15 | Add Approval Group | Managers | |
Add Approval Group | GeneralApprovers |
Decision rule expressions
When creating a decision, you must define rules that determine the course of action for a record. These rules include expressions, which require syntax and evaluation. This topic explains syntax guidelines for creating expressions within the Decision Builder application.
A decision is made up of one or more decision rules. Decision rules are a collection of values arranged as if/then rules. If the criteria of a rule is met, then a specific outcome takes place.
Each decision rule is composed of the following:
- Input fields values from the input table record. The values of input fields are used in expressions to create the rule which concerns them.
- An expression which contains a set of criteria for the input field's decision. If the criteria in the expression is true, then an action takes place.
- The action that takes place if the expression criteria is matched at run time.
Configuration
Create decision rules in the Rules subtable. There is an expression field for each input field of your decision in the rows of the subtable. By default, there is only an expression field for Input Field 1. You must enter values in Input Field 2, Input Field 3, and Input Field 4 before their corresponding expression fields appear in the subtable.
In Decision Builder expressions, the left-hand side of the expression is implied from the value of the associated input field. For example, instead of an expression being field1 <= 12, the expression is just <= 12. When a decision is run, the input expressions are always evaluated as true or false. If all input expressions in a single rule evaluate as true, then that rule is followed.
Create expressions by clicking into an expression field. This opens a dialog box with different button options available to help you build an expression based on the value of the input field. You can use multiple options to build your if/then rule expression.
The following sections describe the different options you can use to build an expression.
Comparisons
Use simple comparison to compare the value of the input field to a constant or other field value. Create comparisons with the <, >, and = buttons. If you need to determine if the input field value is equal to another constant or field value, only enter the value in the expression. In other words, use the Field or Constant buttons to enter the desired value and not the = button. For example:
| Example expression | Expression true if... |
|---|---|
| "200" | input field value is 200 |
| <100 | input field value is less than 100 |
| <field2 | input field value is less than the value of field2 |
| <=25 | input field value is less than or equal to 25 |
| >15 | input field value is greater than 15 |
| >=50 | input field value is greater than or equal to 50 |
Intervals
Intervals can be used on number type input fields when checking if an input field value is contained within a boundary or lies outside of it. Create intervals with the .. button. You can use parentheses or brackets on your interval to declare whether the boundary value should be included or not. Parentheses and brackets that face each other, such as the ( ) and [ ] buttons, creates an AND scenario in the interval expression. Parentheses and brackets facing away from each other, such as the ) ( and ] [ buttons, creates an OR scenario the interval expression. For example:
| Example expression | Expression is true if... |
|---|---|
| (1..5) | input field value > 1 and input field value < 5 |
| [10..20] | input field value >= 10 and input field value <= 20 |
| )50..100( | input field value < 50 or input field value > 100 |
| ]50..100[ | input field value <= 50 or input field value >= 100 |
| [20..30) | input field value >= 20 and input field value < 30 |
Alternatives
Alternatives in expressions create more options for the expression to be true. Create alternatives in an expression with the , button. The comma creates an OR scenario between two components of an expression. For example:
| Example expression | Expression is true if... |
|---|---|
| 1,5,9 | input field value = 1 or input field value = 5 or field = 9 |
| field2,field3 | input field value equals either the value or field2 or the value of field3 |
| "100","200" | input field value = "value1" or input field value = "value2" |
| 1,[5..10] | input field value = 1 or input field value is within 5 and 10 |
Using functions
Functions are another way to define a rule. The Not, Is Empty, and Exists buttons are the functions currently available in expressions. For example:
| Example expression | Expression is true if... |
|---|---|
| Not(5) | input field value is any number other than 5 |
| Not(field2) | input field value is not equal to the value of field2 |
| IsEmpty(field1) | field1 value is empty or null |
| Exists(field1) | field1 value is not null |
Decision Builder application
Use the Decisions Builder application to create a basic if/then conditional with resulting sets of actions. It provides a simple way to automate common business processes without needing extensive technical developer experience.
Decisions Builder application records can either be created by Nextworld developers and shipped with other application metadata, or created directly by customers. For example, a customer may add approvals to a workflow process. The approval may require an if/ then scenario, such as if John Smith is the individual requesting the transaction approval, then automatically approve the transaction.
The records in this application must contain decision rules, which provide a simple, flow-based approach to implementing business logic. Decision rules are a set of actions that are performed when a set of criteria is met. The decision criteria is based on at least one defined input field. The decision actions are the business process paths taken when criteria is met. If there are multiple actions for one set of criteria, they are performed simultaneously and independent of each other when criteria is met. In other words, the actions run at the same time and do not rely on one another for completion.
For example, a decision rule may follow this logic:
| Criteria | Action |
|---|---|
| If the shipped item amount is less than zero... | ...then change the workflow status to Invoiced. |
The decision rule must be configured in the following format:
| Input Field 1 | Input Field 1 Expression | Action | Workflow Transition Key |
|---|---|---|---|
ShippedQuantity | >0 | Invoiced |
Learn more about decision rules and how to configure them in the Decisions section.