Make a decision flow logic
Summarize
Summary of Make a Decision Flow Logic
The Make a Decision flow logic in ServiceNow's Flow Designer enables users to implement decision table branching logic for scenarios requiring multiple conditional paths. This approach is more efficient and easier to read than traditional nested If statements or switch cases. It allows users to define inputs like age, accident history, and car model to determine outcomes such as insurance coverage levels.
Show less
Key Features
- Decision Table Integration: Users must create an external decision table that defines branch paths based on inputs.
- Multiple Inputs and Outputs: Decision tables support any number of inputs and can return single or multiple answers, displayed as branch paths or data pills.
- Branching Options: The Use Branches option allows each decision answer to be displayed in its own flow logic block, akin to If statements.
- Otherwise Branch: The Include Otherwise option creates a branch for actions when the decision table yields no answer, similar to Else logic.
- Execution Modes: Users can choose to run only the first matching decision or all matching decisions, influencing the outputs they receive.
Key Outcomes
By utilizing the Make a Decision flow logic, ServiceNow customers can streamline complex decision-making processes, enhance readability, and improve workflow efficiency. Customers can expect to manage input-driven decisions effectively, resulting in precise actions based on the outcomes of their configured decision tables.
You can use the decision table branching logic in situations where multiple conditional paths are required, as an alternative to nested If, Else If, or Else flow logic. For example, if you want to determine what kind of car insurance you need, you can add inputs such as your age, accident history, and car model to the decision table to determine a level of insurance coverage. This logic can save you time and present a more readable format than nested if conditions or switch case statements.
- When the Use Branches check box is cleared, the Make a decision data pills in other flow components is supported only if there are no branches.
- The Make a decision data pill can be used in the answer branches only when the Use Branches check box is selected.
- When you set a data pill value from inside an answer branch of Make a decision flow logic, the data pill value is only available to other actions in the same branch. Referencing a data pill value that was set inside an answer branch from outside of the flow logic branch produces a null value.
Inputs
| Input | Description |
|---|---|
| Decision Label | Descriptive label for the decision that you want to make. For example, you can create the Recommended Insurance Policy label if you want to determine the level of insurance coverage that you need. This value overrides the default action label. |
| Decision Table | Reference to a Decision Table [sys_decision] record. This record provides the decision input answers that are available to the flow. To create a new decision table, click the create new record icon ( Note: If you have Decision Builder installed, clicking the create new record icon ( |
| Execution | Decision answers you want the flow to run.
Note: Set the Use Branches option to specify how Flow Designer displays matching decision answers. |
| Use Branches | Option to display each possible decision answer in its own branch flow logic block.
Use the branch flow logic block to specify what Flow Designer content to run
where the condition matches a specific decision table answer. Each branch flow logic block
is equivalent to an If flow logic block for each answer. Disable branches when you want
to return one or more answer records instead of branch flow logic blocks. Warning: When you clear and confirm the Use Branches option,
Flow Designer removes the flow logic blocks for each branch and removes
the Include Otherwise check box. Reselecting the Use
Branches check box does not restore any removed branch flow logic
blocks. |
| Include Otherwise | Option to add the otherwise branch to the list of available
answers. This option is only available when Use Branches is selected.
You can use this branch to specify the actions and subflows to run when the decision table
does not generate an answer. An Otherwise branch is equivalent to an Else flow logic block.
Note: If you specify a decision table default answer, this branch will never run because
the decision table always selects an answer. |
| Decision table inputs | List of Decision Input [sys_decision_input] records that are associated with your decision table. Flow Designer displays a separate input for each record. For example, if you have decision inputs for Units Ordered and Location of Sale, an input displays for each record. |
Outputs
| Field | Description | Data Type |
|---|---|---|
| Answer table | Table containing the answer records. Each Decision [sys_decision_question] table record refers to a matching answer record. | Table Name |
| Ordered IDs | List of matching answer record sys_id values generated by the decision table. Flow Designer only generates this output when the Use Branches option is false and the Execution option is Run all decisions that match. You can use this output as the input for a For Each flow logic block or a Look Up Record action. Flow Designer sorts the list by the Order value listed in the Decision [sys_decision_question] table. | List |
| Answer records | Answer records returned by the decision table. Returns a single record when Execution is First decision that matches. Returns a list of records when Execution is Run all decisions that match. | Record or Records |
| Count | The number of answer records returned by the decision table. Only displayed when Execution is Run all decisions that match. | Integer |
Use make a decision flow logic to determine insurance coverage
In this example, the flow uses a decision from the Insurance Coverage decision table, which an administrator had configured to determine the insurance coverage that was based on three inputs. The flow displays all the inputs that were used by the decision table in Flow Designer. These inputs can be entered manually, or by dragging data pills into the inputs from the data panel on the right side of the screen. Below this section, the branches for each answer are shown in the decision table.
Execution details
- The header shows the state, start time, and runtime for the flow logic.
- The action shows details about the decision table configuration and inputs.
- Each possible answer for the decision table is represented as a branch. The state field indicates whether the branch was evaluated and the evaluation result. This section also displays details about the actions that are taken within a branch. Branches that evaluate to true are highlighted in green.