Exploring Decision Builder

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 3 minutes to read
  • Learn how you can create and maintain decision tables in Workflow Studio for use in flows, subflows, and anywhere on the ServiceNow AI Platform where you write code.

    Decision tables enable you to decouple decision logic from your code. This means that you can create a decision table in Workflow Studio with your application logic and then reference the decision table to execute the logic elsewhere, such as in a flow or script. This decoupling enables you to create more efficient and maintainable flows and scripts and allows the decision logic to be managed directly by the relevant business subject matter expert.

    Workflow for creating decision tables

    The following illustration depicts the process for creating decision tables in Workflow Studio.

    Figure 1. Process for creating decision tables
    Infographic depicting the process of creating a decision table in Workflow Studio
    The workflow for creating decision tables in Workflow Studio is as follows:
    1. A developer is writing a script or authoring a flow or subflow and realizes there is a need for a decision table. Decision tables are a more maintainable solution than hard-coded logic for the following scenarios:
      • There is a complex set of conditional, nested if/else or switch statements in the code.
      • The logic powering the code might change frequently.
      • There is a need to share the application logic with non-developers in a readable format.
      • There is a need for application logic to be managed independently from where it is implemented.
      • There is a need for application logic to be managed by non-developers.
      • There is a need to apply the same logic in more than one flow, subflow, or script.
      • There is application or business logic the developer wants to manage separately from the code.
    2. The developer creates the decision table in Workflow Studio and adds inputs and result columns (outputs for the decisions).
    3. A developer or a business subject matter expert (SME) can perform the next steps.
      1. Add condition columns to structure the rules.
      2. Add decision rows to build conditional rules and corresponding results.
      3. Test the decision table.
      4. Publish the decision table.
    4. The developer can use the decision table in one of two ways.
      • They can create a code snippet of the decision table and insert it into their code.
      • They can add Make a decision logic in their flow or subflow and reference the decision table.
    5. If the decision table must be updated to reflect new logic, the developer or business SME can create a new draft of the table. They can test the table using the new logic and then publish the new version.
      Note:
      For any decision table that doesn't use draft authoring, any change the developer or business SME makes is automatically active.

    Decision Builder user interface

    Learn more about the decision tables user interface in Workflow Studio.

    Decision tables homepage in Workflow Studio

    Decision tables section of Workflow Studio

    You can do the following on the Decision tables homepage in Workflow Studio:
    • Create a table by selecting New and selecting Decision table.
    • Open a table that you've already created.
    • Sort and filter the list of your decision tables.
    • Edit the available columns by selecting the List Actions icon ().
    • Delete selected decision tables.

    New decision table

    New decision table page

    You can do the following on a new decision table:
    • Name your decision table and provide a description.
    • Select an application to associate the decision table with.
    • Select the scope that the decision table should be accessible from.
    • Choose whether to enable draft authoring, which enables you to author decision tables in draft mode before publishing to lock it and make it available for use.

    Decision table

    New decision table with an input being created

    When you first create a decision table, you can do the following:
    • Add inputs, condition columns, and result columns.
    • Add decision rows.
    • Save the decision table.
    • Export the table to Microsoft Excel and import back into Decision Builder. You can export and import only after saving the table.
    • Edit the properties of the decision table.
    • Delete the decision table.

    Complete decision table

    Complete decision table

    On a saved decision table, you can do the following:
    • Publish the decision table.
    • Edit the decision rows again in the Decision Builder interface.
    • Edit the inputs, condition columns, or result columns.
    • Export to Excel, edit the decision rows again, and import into Decision Builder to update the decision table.
    • Test your decision table to make sure the rules provide the desired outcome for a given set of input data.