OBLYTECH Logo
OBLYTECH Logo

Decision Builder in ServiceNow: How Decision Tables Work

Decision Builder is the ServiceNow tool for creating and maintaining decision tables, which hold if-then rules outside application code. A table reads inputs, checks them against condition columns, and returns one or more results. Since the Washington DC release it sits inside Workflow Studio, where flows, subflows, playbooks and scripts can call the same table.

Decision Builder sits inside Workflow Studio

Since the Washington DC release, Decision Builder is part of Workflow Studio, which also covers flows, subflows, actions and playbooks. Workflow Studio is active by default on the ServiceNow AI Platform, and its newer updates come through the Workflow Studio application in the ServiceNow Store.

Decision tables created in the classic environment are supported in Workflow Studio, though some field types and complex conditions open in a limited form.

A table is built from four working parts

Part What it holds Settings to know
Input A value the table reads at runtime Label, type and whether it is mandatory
Condition column The test applied to one input Linked input, data to evaluate, condition type and default operator
Decision row The conditions and answers for one case An operator and value per condition column, a result per result column
Result column The output the table returns Label, result type and an optional reference filter

Inputs can read from existing ServiceNow records, external data sources or data provided at runtime. Adding more than 30 inputs can slow the application while you build the table. A Reference input adds a Reference column and can feed several condition columns, so one reference record can be tested on several fields. A Choice input can use a choice list when that list sits in the same application scope as the table.

A row can be activated or deactivated. A deactivated row stays in the table but is excluded during execution, a control the Yokohama release added. Currency and True/False results fall back to 0.00 and false when no alternate result is entered.

Building a table step by step

Creating a table needs admin, decision_table_admin, or delegated developer permissions.

  1. Navigate to All > Process Automation > Workflow Studio, select New, then select Decision table.
  2. On the properties form, enter a name and description, choose the application, set Accessible from, and decide whether to enable draft authoring.
  3. Select Build decision table, then add each input with its label, type and mandatory setting.
  4. Add a condition column for each input you test, with a condition type and default operator.
  5. Add result columns with their result types.
  6. Add decision rows, entering an operator and value in each condition cell and a result in each result cell. Select Save.
  7. Select Publish and confirm in the dialog.

Creating the table inside a flow

Since the Xanadu release, the structure can be built inside a flow or a playbook; a subflow offers the same inline step, with the rules added afterwards. From Flow Logic, select Make a Decision, enter a Decision Label, and use the Create new record icon in the Decision Table field. Add inputs from the flow’s data and a result column, then select Create and Open. The table opens in its own tab, where the rules are added. Reference inputs and choice options are added in that tab.

Keeping rules current without breaking live logic

Draft authoring is on by default for new tables. Turning it on for an existing table moves that table into a published state. To change a published table, select Create Draft, edit it, save, and publish. Flows, playbooks and scripts keep using the published version until the draft is published, and older versions are not kept. Without draft authoring, a change is active without a publish step.

A Default result row appears at the bottom of the table once a result column exists. It gives an answer for input that no rule matches. If the row has no values, or they have been cleared, no default result is returned.

To change a rule, select its cell and edit the operator, the value, or both. Duplicating a row uses the icon at its far left, which helps when several rows share a first condition. The Rank column sets the order in which rows are evaluated. Double-click a rank, enter a value, and press Enter, because leaving the field without pressing Enter does not change it. Large tables suit rank-based reordering, since roughly 20 rows show at a time.

Filters on condition and result columns show a subset of rows for editing. They apply after you save and match cell values rather than operators. Duplicate Decision Table copies a table’s structure. The option to include decision rows is offered for tables with 300 rows or fewer.

Flows and scripts call a table in different ways

A decision table is built in Workflow Studio, but the decision runs in the flow or script that calls it. That separation lets one table serve several places.

In a flow, the Make a decision logic runs in one of two modes: first decision that matches, or run all decisions that match. With Use Branches on, each answer becomes its own branch, like separate If blocks. Include Otherwise adds a branch for input that matches no answer. Turning Use Branches off returns answer records instead. Data pills created inside a branch exist within that branch. In a playbook, the Xanadu release added the Make a Decision – First Match activity.

For a script, select Create Code Snippet from a published table’s menu. One snippet calls getDecision(), which returns the first matching result. The other calls getDecisions(), which returns all matching results. Insert the one you need and define the data for each input variable.

The DecisionTableAPI class is reached through the sn_dt namespace and needs the decision_table_crud_api role. getDecision takes a table ID and an object of inputs (and getDecisions does the same for all matching answers), and returns one answer record. With no inputs, it returns the first default answer. If there is no default and no match, it returns an error. getDecisions returns an array of answer records. When a table supports several answers, the result_elements field lists each one.

Input keys are lowercase, begin with u_, and replace spaces with underscores, so an input called Incident has the key u_incident. Date/Time inputs must be passed in yyyy-MM-dd HH:mm:ss format. The engine evaluates them as absolute values with no time zone conversion, so a user’s local time must be converted first.

Large tables can be edited in Excel

Export a table to .xlsx, edit it, and import it back. Edit the Condition and Result cells, keep the headers unchanged, and do not add or change condition or result columns. Data after five consecutive empty rows is ignored on import. Advanced rows are read-only in Excel.

Each change is validated before it is applied. A failed import produces an Error.xlsx file that describes each problem, which you fix and re-import. Exports offer only reference values the user can read: read access follows the access control lists on the referenced table. Excel editing is not available on tables without condition columns, with unsaved changes, or with a condition tied to an inactive input. Excel editing also does not support localized content, so it works on English instances.

Access depends on roles and domains

Each task lists the roles allowed to do it. For example, duplicating rows is open to decision_rule_author, and setting an initial default on an older table needs admin. A delegated developer has more permissions than a user and fewer than an admin, and each one holds its own set of permissions. A table belongs to the domain of its creator. A user in a parent domain can see a child domain’s tables but must switch into the owning domain to edit them.

Each release changed one part of the tool

Release Change to Decision Builder
Washington DC Decision Builder joins Workflow Studio. From Patch 3, updating Workflow Studio also updates Decision Builder.
Yokohama Filtering, reference lookup and preview icons, pagination, and row activation.
Xanadu Inline table creation in flows, subflows and playbooks, Make a Decision – First Match in playbooks, rank-based row ordering, and scrolling in large tables with headers pinned.
Australia No change recorded for Decision Builder in the release notes.

Frequently asked questions

Is Decision Builder separate from Workflow Studio?

No. Since the Washington DC release it has been part of Workflow Studio, and the core feature is active by default on the ServiceNow AI Platform.

How do I change a table that flows already use?

Turn on draft authoring, select Create Draft, edit it, save, and publish. Flows, playbooks and scripts keep using the published version until the draft is published.

What does a table return when no rule matches?

It returns the default result if the Default result row has values. Without them, no default result is returned. Through the API, getDecision returns an error when there is neither a default nor a match.

Which API call returns one answer and which returns many?

getDecision returns the first matching result, and getDecisions returns all matching results. Both can be generated as code snippets from the table’s menu.

Why does a date comparison look off?

Date/Time inputs are evaluated as absolute values with no time zone conversion. Convert a user’s local time to the yyyy-MM-dd HH:mm:ss format before passing it in.

Can I edit a large table in a spreadsheet?

Yes. Export to .xlsx, edit the Condition and Result cells, and import the file back. If the import fails, the Error.xlsx file lists each problem for correction.