Decision tables workflow

  • Release version: Yokohama
  • Updated January 30, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Decision tables workflow

    Decision tables in Workflow Studio allow ServiceNow customers to separate decision logic from the underlying code. This enables more maintainable, efficient, and reusable flows, subflows, playbooks, and scripts on the ServiceNow AI Platform. Decision tables facilitate business subject matter experts (SMEs) to directly manage decision logic without requiring developer intervention.

    Show full answer Show less

    When to Use Decision Tables

    • When code contains complex conditional, nested if/else, or switch statements.
    • When the logic changes frequently and needs easier updates.
    • When application logic should be shared with non-developers in a clear format.
    • When logic needs to be independently managed from the implementation location.
    • When the same logic is applied across multiple flows, subflows, or scripts.
    • When business or application logic requires separate management from code.

    Workflow for Creating and Using Decision Tables

    • A developer identifies the need for a decision table during script or flow creation.
    • The developer creates the decision table in Workflow Studio by defining inputs and result columns.
    • Either the developer or a business SME adds condition columns and decision rows to define rules and outcomes.
    • The decision table is tested and then published for use.
    • The decision table can be referenced in code via a snippet, used in flows or subflows with the "Make a decision" logic, or added to playbooks with the "Make a Decision - First Match" activity.
    • If logic updates are needed, a new draft can be created, tested, and published without impacting the active version until published.

    Practical Benefits

    By using decision tables, ServiceNow customers can ensure decision logic is easier to maintain, update, and govern. This separation improves collaboration between developers and business SMEs, reduces hard-coded complexity, and promotes reuse across various automation components.

    Learn how to create and maintain decision tables in Workflow Studio for use in flows, subflows, playbooks, 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 , playbook, 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 a few 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.
      • They can add a decision table to a playbook using the Make a Decision - First Match activity.
    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. To create a Decision Table, See Create decision tables in Workflow Studio.
      Note:
      For any decision table that doesn't use draft authoring, any change the developer or business SME makes is automatically active.