---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# DecisionTableAPI - Scoped, Global

# DecisionTableAPI - Scoped, Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 46 minutes to read

The DecisionTableAPI class enables you to access Decision Tables data in scoped and global server-side scripts.

To access DecisionTableAPI methods, use the `sn_dt`
namespace. You must have the decision_table_crud_api role to use this API. To learn more about
Decision Tables, see [Decision Tables](https://www.servicenow.com/docs/access?context=decision-table&version=xanadu&pubname=xanadu-application-development&ft:locale=en-US).

## DecisionTableAPI - DecisionTableAPI() {#ariaid-title2}

Instantiates a DecisionTableAPI object.
{#DecisionTableAPI-DecisionTableAPI__table_brg_3tc_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#DecisionTableAPI-DecisionTableAPI__table_brg_3tc_hhb}  

    var dt = new sn_dt.DecisionTableAPI();

## DecisionTableAPI - createAnswerElementChoices(String decisionID, Array questions) {#ariaid-title3}

Creates multiple records in the Choices \[sys_choice\] table that are linked to answer
elements.
{#DecisionTableAPI-createAnsElChs_S_O__table_u5r_1zg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
| choices | Array | Array of objects used to create records in the Choices \[sys_choice\] table. Each object creates one choice record. [ { answerElementID: "String", label: "String", order: Number, value: "String" } ] |
| choices.answerElementID | String | Sys_id of the answer element to associate with the choice. Located in the Result \[sys_decision_multi_result_element\] table. |
| choices.label | String | Label of the choice. |
| choices.order | Number | Optional. Order of the choice. |
| choices.value | String | Value of the choice. |
[Table 2. Parameters]

{#DecisionTableAPI-createAnsElChs_S_O__table_u5r_1zg_qvb} {#DecisionTableAPI-createAnsElChs_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-createAnsElChs_S_O__errors-message-entry}{#DecisionTableAPI-createAnsElChs_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "results": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-createAnsElChs_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results | Array with information about the status of each choice. Data type: Array "results": [ { "errors": [Array], "record": GlideRecord, "status": "String" } ] |
| \<Object\>.results.errors | Error information for the choice. Data type: Array "errors": [ { "message": "String", "type": "String } ] |
| \<Object\>.results.errors.message | Error message. Data type: String |
| \<Object\>.results.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results.record | GlideRecord reference to the choice created in the Choices \[sys_choice\] table. Data type: GlideRecord |
| \<Object\>.results.status | Status that indicates whether the choice record was successfully created. Possible values: * Success * Failure {#DecisionTableAPI-createAnsElChs_S_O__ul_lb5_3jm_svb} Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-createAnsElChs_S_O__d3315e246} Data type: String |
[Table 3. Returns]

{#DecisionTableAPI-createAnsElChs_S_O__table_ps1_bgn_lvb}  
This example creates two choices for an answer element.

    var decisionID = 'a45be18c3d839910f8776a598af91269';
    var answerElementID = '99d197c83d0b9910f8776a598af912df';
    var choices = [
       {
          label: 'Hyderabad',
          value: 'hyd',
          answerElementId: answerElementID,
          order: 20
       },
       { 
          label: 'Mumbai', 
          value: 'mum',
          answerElementId: answerElementID,
          order: 40
       }
    ];

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.createAnswerElementChoices(decisionID, choices);
    gs.info('Status - ' + response.status);
    gs.info('First choice sys id - ' + response.results[0].record.getValue('sys_id'));
    gs.info('Second choice sys id - ' + response.results[1].record.getValue('sys_id'));

Output:

    Status - Success
    First choice sys id - 6bc0d3c03d0b9910f8776a598af912c6
    Second choice sys id - 6fc0d3c03d0b9910f8776a598af912c9

## DecisionTableAPI - createAnswerElements(String decisionID, Array answerElements) {#ariaid-title4}

Creates multiple records in the Result \[sys_decision_multi_result_element\] table that are related to the specified decision table.
{#DecisionTableAPI-createAnsEls_S_O__table_adc_lyg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
| answerElements | Array | Array of objects used to create records in the Result Elements \[sys_decision_multi_result_element\] table. Each object creates one answer element record. [ { label: "String", maxsize: Number, order: Number, reference: "String", type: "String" } ] |
| answerElements.label | String | Label of the answer element record. |
| answerElements.maxsize | Number | Optional. Maximum number of characters allowed in the answer element field. Use this property only if answerElements.type is `String`. Default value: 250 |
| answerElements.order | Number | Optional. Order of the answer element. |
| answerElements.reference | String | Required if the value of answerElements.type is `Reference`. Name of the reference table used by the answer element. |
| answerElements.type | String | Answer element input type. Valid values: * Boolean * Choice * Currency * Decimal * Due_date * [Glide_date](https://servicenow-prod.fluidtopics.net/bYyEJu7Q1dOuTUxs_Iquuw#c_GlideDateScopedAPI "The scoped GlideDate class provides methods for performing operations on GlideDate objects, such as instantiating GlideDate objects or working with GlideDate fields.") * [Glide_date_time](https://servicenow-prod.fluidtopics.net/xOhnNqU1cKMjoQSfmtxVCw#c_GlideDateTimeScoped "The scoped GlideDateTime class provides methods for performing operations on GlideDateTime objects.") * [Glide_duration](https://servicenow-prod.fluidtopics.net/h4zx9JYfuXNqNW4e1MWiGw#c_GlideDurationScopedAPI "The GlideDuration class provides methods for working with spans of time known as durations.") * Integer * Longint * Reference * String {#DecisionTableAPI-createAnsEls_S_O__ul_c25_1vf_lzb} |
[Table 4. Parameters]

{#DecisionTableAPI-createAnsEls_S_O__table_adc_lyg_qvb} {#DecisionTableAPI-createAnsEls_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-createAnsEls_S_O__errors-message-entry}{#DecisionTableAPI-createAnsEls_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "results": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-createAnsEls_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results | Array with information about the status of each answer element. Data type: Array "results": [ { "errors": [Array], "record": GlideRecord, "status": "String" } ] |
| \<Object\>.results.errors | Error information for the answer element. Data type: Array "errors": [ { "message": "String", "type": "String } ] |
| \<Object\>.results.errors.message | Error message. Data type: String |
| \<Object\>.results.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results.record | GlideRecord reference to the answer element created in the Result Elements \[sys_decision_multi_result_element\] table. Data type: GlideRecord |
| \<Object\>.results.status | Status that indicates whether the answer element record was successfully created. Possible values: * Success * Failure {#DecisionTableAPI-createAnsEls_S_O__ul_lb5_3jm_svb} Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-createAnsEls_S_O__d3315e246} Data type: String |
[Table 5. Returns]

{#DecisionTableAPI-createAnsEls_S_O__table_ps1_bgn_lvb}  
This example creates two answer elements for a decision table.

    var decisionID = 'a45be18c3d839910f8776a598af91269';
    var answerElements = [
       {
          label: 'City name',
          name: 'city',
          type: 'choice',
          comments: 'City name',
       },
       { 
          label: 'Assigned To', 
          name: 'assigned_to',
          type: 'reference',
          reference: 'sys_user'
       }
    ];

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.createAnswerElements(decisionID, answerElements);
    gs.info('Status - ' + response.status);
    gs.info('First answer element sys id - ' + response.results[0].record.getValue('sys_id'));
    gs.info('Second answer element sys id - ' + response.results[1].record.getValue('sys_id'));

Output:

    Status - Success
    First answer element sys id - 41c707803d0b9910f8776a598af91201
    Second answer element sys id - 51c707803d0b9910f8776a598af91217

## DecisionTableAPI - createConditions(String decisionID, Array conditions) {#ariaid-title5}

Creates multiple records in the Decision Conditions
\[sn_decision_table_decision_condition\] table that are related to the specified decision
table.
{#DecisionTableAPI-createConds_S_O__table_cqq_fyg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
| conditions | Array | Array of objects used to create records in the Decision Conditions \[sn_decision_table_decision_condition\] table. Each object creates one decision condition record. [ { decisionInput: "String", defaultOperator: "String", label: "String" } ] |
| conditions.decisionInput | String | Sys_id of the decision input to associate with the condition. Located in the Decision Inputs \[sys_decision_input\] table. |
| conditions.defaultOperator | String | Optional. Default operator for the condition. For a list of valid operators, see [Operators available for filters and queries](https://www.servicenow.com/docs/access?context=r_OpAvailableFiltersQueries&version=xanadu&pubname=xanadu-platform-user-interface&ft:locale=en-US). |
| conditions.label | String | Label of the decision condition record. |
[Table 6. Parameters]

{#DecisionTableAPI-createConds_S_O__table_cqq_fyg_qvb} {#DecisionTableAPI-createConds_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-createConds_S_O__errors-message-entry}{#DecisionTableAPI-createConds_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "results": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-createConds_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results | Array with information about the status of each decision condition. Data type: Array "results": [ { "errors": [Array], "record": GlideRecord, "status": "String" } ] |
| \<Object\>.results.errors | Error information for the decision condition. Data type: Array "errors": [ { "message": "String", "type": "String } ] |
| \<Object\>.results.errors.message | Error message. Data type: String |
| \<Object\>.results.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results.record | GlideRecord reference to the decision condition created in the Decision Conditions \[sn_decision_table_decision_condition\] table. Data type: GlideRecord |
| \<Object\>.results.status | Status that indicates whether the decision condition record was successfully created. Possible values: * Success * Failure {#DecisionTableAPI-createConds_S_O__ul_lb5_3jm_svb} Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-createConds_S_O__d3315e246} Data type: String |
[Table 7. Returns]

{#DecisionTableAPI-createConds_S_O__table_ps1_bgn_lvb}  
This example creates two decision conditions for a decision table.

    var decisionID = 'a45be18c3d839910f8776a598af91269';
    var conditions = [
        {
            label: 'Total count',
            decisionInput: '22bde5003dc39910f8776a598af91292',        
            defaultOperator: '!='
        },
        {
            label: 'Is Incident Active',
            decisionInput: '6abde5003dc39910f8776a598af9127e',
            default_operator: 'ISEMPTY',        
            order: 10,
            field: 'u_incident.active'
        }
    ];

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.createConditions(decisionID, conditions);
    gs.info('Status - ' + response.status);
    gs.info('First condition sys id - ' + response.results[0].record.getValue('sys_id'));
    gs.info('Second condition sys id - ' + response.results[1].record.getValue('sys_id'));

Output:

    Status - Success
    First condition sys id - c1530f4c3dc79910f8776a598af912ef
    Second condition sys id - c9530f4c3dc79910f8776a598af912f1

## DecisionTableAPI - createDecisionTable(Object decisionTable) {#ariaid-title6}

Creates a decision table record in the Decision Tables \[sys_decision\]
table.
{#DecisionTableAPI-createDT_O__table_os1_bgn_lvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionTable | Object | Key-value pairs of the field names and values to use to create a decision table record. { "accessibleFrom": "String", "name": "String", "scope": "String } |
| decisionTable.accessibleFrom | String | Optional. Scopes that have access to the decision table record. Valid values: * package_private * public {#DecisionTableAPI-createDT_O__ul_zbl_yln_lvb} |
| decisionTable.name | String | Name of the decision table. |
| decisionTable.scope | String | Scope of the decision table record. |
[Table 8. Parameters]

{#DecisionTableAPI-createDT_O__table_os1_bgn_lvb} {#DecisionTableAPI-createDT_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-createDT_O__errors-message-entry}{#DecisionTableAPI-createDT_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "record": GlideRecord, "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-createDT_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.record | GlideRecord reference to the decision table created in the Decision Tables \[sys_decision\] table. Data type: GlideRecord |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-createDT_O__ul_lb5_3jm_svb} Data type: String |
[Table 9. Returns]

{#DecisionTableAPI-createDT_O__table_ps1_bgn_lvb}  
This example creates an Emergency Change Policy decision table.

    var decisionTable = {
        name: 'Emergency Change Policy',  
        scope: 'global',
        accessibleFrom: 'public'
    };

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.createDecisionTable(decisionTable);
    gs.info('Status -' + response.status);
    gs.info('Decision Table sys id - ' + response.record.getValue('sys_id'));

Output:

    Status - Success
    Decision Table sys id - 665569083d839910f8776a598af91223

## DecisionTableAPI - createInputChoices(String decisionID, Array choices) {#ariaid-title7}

Creates multiple records in the Choices \[sys_choice\] table that are linked to decision
inputs.
{#DecisionTableAPI-createInChs_S_O__table_u5r_1zg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
| choices | Array | Array of objects used to create records in the Choices \[sys_choice\] table. Each object creates one choice record. [ { inputID: "String", label: "String", order: Number, value: "String" } ] |
| choices.inputID | String | Sys_id of the decision input to associate with the choice. Located in the Decision Inputs \[sys_decision_input\] table. |
| choices.label | String | Label of the choice. |
| choices.order | Number | Optional. Order of the choice. |
| choices.value | String | Value of the choice. |
[Table 10. Parameters]

{#DecisionTableAPI-createInChs_S_O__table_u5r_1zg_qvb} {#DecisionTableAPI-createInChs_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-createInChs_S_O__errors-message-entry}{#DecisionTableAPI-createInChs_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "results": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-createInChs_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results | Array with information about the status of each choice. Data type: Array "results": [ { "errors": [Array], "record": GlideRecord, "status": "String" } ] |
| \<Object\>.results.errors | Error information for the choice. Data type: Array "errors": [ { "message": "String", "type": "String } ] |
| \<Object\>.results.errors.message | Error message. Data type: String |
| \<Object\>.results.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results.record | GlideRecord reference to the choice created in the Choices \[sys_choice\] table. Data type: GlideRecord |
| \<Object\>.results.status | Status that indicates whether the choice record was successfully created. Possible values: * Success * Failure {#DecisionTableAPI-createInChs_S_O__ul_lb5_3jm_svb} Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-createInChs_S_O__d3315e246} Data type: String |
[Table 11. Returns]

{#DecisionTableAPI-createInChs_S_O__table_ps1_bgn_lvb}  
This example creates two choices for a decision input.

    var decisionID = 'a45be18c3d839910f8776a598af91269';
    var inputID = '4d1f8f083d0b9910f8776a598af91274';
    var choices = [
       {
          label: 'Hyderabad',
          value: 'hyd',
          inputId: inputID,
          order: 20
       },
       { 
          label: 'Mumbai', 
          value: 'mum',
          inputId: inputID,
          order: 40
       }
    ];

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.createInputChoices(decisionID, choices);
    gs.info(JSON.stringify(response));
    gs.info('Status - ' + response.status);
    gs.info('First choice sys id - ' + response.results[0].record.getValue('sys_id'));
    gs.info('Second choice sys id - ' + response.results[1].record.getValue('sys_id'));

Output:

    Status - Success
    First choice sys id - 6bc0d3c03d0b9910f8776a598af912c6
    Second choice sys id - 6fc0d3c03d0b9910f8776a598af912c9

## DecisionTableAPI - createInputs(String decisionID, Array inputs) {#ariaid-title8}

Creates multiple records in the Decision Inputs \[sys_decision_input\] table that are
related to the specified decision table.
{#DecisionTableAPI-createInputs_S_O__table_rrm_zxg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
| inputs | Array | Array of objects used to create records in the Decision Input \[sys_decision_input\] table. Each object creates one decision input record. [ { label: "String", maxsize: Number, order: Number, reference: "String", type: "String" } ] |
| inputs.label | String | Label of the decision input record. |
| inputs.maxsize | Number | Optional. Maximum number of characters allowed in the input field. Use this property only if inputs.type is `String`. Default value: 250 |
| inputs.order | Number | Optional. Order of the input. |
| inputs.reference | String | Required if the value of inputs.type is `Reference`. Name of the reference table used by the decision input. |
| inputs.type | String | Decision input type. Valid values: * String * Integer * True/False * Choice * Reference * Date * Date/Time {#DecisionTableAPI-createInputs_S_O__ul_xx5_dzb_rvb} |
[Table 12. Parameters]

{#DecisionTableAPI-createInputs_S_O__table_rrm_zxg_qvb} {#DecisionTableAPI-createInputs_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-createInputs_S_O__errors-message-entry}{#DecisionTableAPI-createInputs_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "results": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-createInputs_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results | Array with information about the status of each decision input. Data type: Array "results": [ { "errors": [Array], "record": GlideRecord, "status": "String" } ] |
| \<Object\>.results.errors | Error information for the decision input. Data type: Array "errors": [ { "message": "String", "type": "String } ] |
| \<Object\>.results.errors.message | Error message. Data type: String |
| \<Object\>.results.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results.record | GlideRecord reference to the decision input created in the Decision Inputs \[sys_decision_input\] table. Data type: GlideRecord |
| \<Object\>.results.status | Status that indicates whether the decision input record was successfully created. Possible values: * Success * Failure {#DecisionTableAPI-createInputs_S_O__ul_lb5_3jm_svb} Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-createInputs_S_O__d3315e246} Data type: String |
[Table 13. Returns]

{#DecisionTableAPI-createInputs_S_O__table_ps1_bgn_lvb}  
This example creates two inputs for a decision table.

    var decisionID = 'a45be18c3d839910f8776a598af91269';
    var inputs = [
       {
          label: 'Incident',
          type: 'reference',
          reference: 'incident',
          ref_qual: 'active=true^EQ' 
       },
       {
          label: 'Total count',
          type: 'integer'
       }
    ];

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.createInputs(decisionID,inputs);
    gs.info('Status - ' + response.status);
    gs.info('First input id --' + response.results[0].record.getValue('sys_id'));
    gs.info('Second input id --' + response.results[1].record.getValue('sys_id'));

Output:

    Status - Success
    First input id - 5dbfa58c3d839910f8776a598af91219
    Second input id - 95bfe1803dc39910f8776a598af912fa

## DecisionTableAPI - createQuestions(String decisionID, Array questions) {#ariaid-title9}

Creates multiple records in the Decisions \[sys_decision_question\] table that are
related to the specified decision table.
{#DecisionTableAPI-createQuestions_S_O__table_ucd_qyg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
| questions | Array | Array of objects used to create records in the Decisions \[sys_decision_question\] table. Each object creates one question record. [ { active: Boolean, answer: [Array], condition: "String", defaultAnswer: Boolean, order: Number } ] |
| questions.active | Boolean | Flag that indicates whether the question record is active. Valid values: * true: The question record is active. * false: The question record is not active. {#DecisionTableAPI-createQuestions_S_O__ul_xdh_w1d_rvb} |
| questions.answer | Array | Array of possible answers to the question. For a single result table, the array can only have one object. For a multi-result table, the array can have multiple objects. [ { name: "String", value: "String" } ] |
| questions.answer.name | String | Name of the answer element. Located in the Result \[sys_decision_multi_result_element\] table. |
| questions.answer.value | String | Value of the answer element. Located in the Result \[sys_decision_multi_result_element\] table. |
| questions.condition | String | Conditions required to reach this question. The fields available for the conditions are the decision inputs that are associated with the decision table. For more information about creating conditions, see [Operators available for filters and queries](https://www.servicenow.com/docs/access?context=r_OpAvailableFiltersQueries&version=xanadu&pubname=xanadu-platform-user-interface&ft:locale=en-US). |
| questions.defaultAnswer | Boolean | Flag that indicates whether this question is the default question for the decision table. Valid values: * true: The question is the default question. * false: The question is not the default question. {#DecisionTableAPI-createQuestions_S_O__ul_uqg_skz_rvb} |
| questions.order | Number | Order of the question. |
[Table 14. Parameters]

{#DecisionTableAPI-createQuestions_S_O__table_ucd_qyg_qvb} {#DecisionTableAPI-createQuestions_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-createQuestions_S_O__errors-message-entry}{#DecisionTableAPI-createQuestions_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "results": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-createQuestions_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results | Array with information about the status of each question. Data type: Array "results": [ { "errors": [Array], "record": GlideRecord, "status": "String" } ] |
| \<Object\>.results.errors | Error information for the question. Data type: Array "errors": [ { "message": "String", "type": "String } ] |
| \<Object\>.results.errors.message | Error message. Data type: String |
| \<Object\>.results.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.results.record | GlideRecord reference to the question created in the Decisions \[sys_decision_question\] table. Data type: GlideRecord |
| \<Object\>.results.status | Status that indicates whether the question record was successfully created. Possible values: * Success * Failure {#DecisionTableAPI-createQuestions_S_O__ul_lb5_3jm_svb} Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-createQuestions_S_O__d3315e246} Data type: String |
[Table 15. Returns]

{#DecisionTableAPI-createQuestions_S_O__table_ps1_bgn_lvb}  
This example creates two questions for a decision table.

    var decisionID = 'a45be18c3d839910f8776a598af91269';
    var questions = [
       {
          condition: 'u_item=Phone^u_price=500^EQ',
          answer:[
             {
                name: 'u_seller',
                value: '02826bf03710200044e0bfc8bcbe5d64'
             },
             {
                name: 'u_discount',
                value: '5'
             }
          ],
          active: true,
          defaultAnswer: true,
          order: 300
       },
       {
          condition: 'u_item=Laptop^u_price>800^EQ',
          answer:[ 
             {
                name: 'u_discount',
                value: '20'
             }
          ],
          active: true,
          defaultAnswer: false,
          order: 150
       }
    ];

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.createQuestions(decisionID, questions);
    gs.info(JSON.stringify(response));
    gs.info('Status - ' + response.status);
    gs.info('First decision sys id - ' + response.results[0].record.getValue('sys_id'));
    gs.info('Second decision sys id - ' + response.results[1].record.getValue('sys_id'));

Output:

    Status - Success
    First decision sys id - 21c8d3003d4b9910f8776a598af91213
    Second decision sys id - e9c8d3003d4b9910f8776a598af91218

## DecisionTableAPI - deleteAnswerElement(String answerElementID) {#ariaid-title10}

Deletes a record in the Result \[sys_decision_multi_result_element\]
table.
{#DecisionTableAPI-deleteAnsEl_S__table_bkq_4yg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| answerElementID | String | Sys_id of the answer element record. Located in the Result Elements \[sys_decision_multi_result_element\] table. |
[Table 16. Parameters]

{#DecisionTableAPI-deleteAnsEl_S__table_bkq_4yg_qvb} {#DecisionTableAPI-deleteAnsEl_S__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-deleteAnsEl_S__errors-message-entry}{#DecisionTableAPI-deleteAnsEl_S__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-deleteAnsEl_S__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-deleteAnsEl_S__ul_lb5_3jm_svb} Data type: String |
[Table 17. Returns]

{#DecisionTableAPI-deleteAnsEl_S__table_ps1_bgn_lvb}  
This example deletes an answer element.

    var answerElementID = '51c707803d0b9910f8776a598af91217';

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.deleteAnswerElement(answerElementID);
    gs.info('Status - ' + response.status);

Output:

    Status - Success

## DecisionTableAPI - deleteChoice(String choiceID) {#ariaid-title11}

Deletes a record in the Choices \[sys_choice\] table.
{#DecisionTableAPI-deleteChoice_S__table_yzy_szg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| choiceID | String | Sys_id of the choice record. Located in the Choices \[sys_choice\] table. |
[Table 18. Parameters]

{#DecisionTableAPI-deleteChoice_S__table_yzy_szg_qvb} {#DecisionTableAPI-deleteChoice_S__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-deleteChoice_S__errors-message-entry}{#DecisionTableAPI-deleteChoice_S__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-deleteChoice_S__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-deleteChoice_S__ul_lb5_3jm_svb} Data type: String |
[Table 19. Returns]

{#DecisionTableAPI-deleteChoice_S__table_ps1_bgn_lvb}  
This example deletes a choice.

    var choiceID = '4532db883d0b9910f8776a598af912e7';

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.deleteChoice(choiceID);
    gs.info('Status - ' + response.status);

Output:

    Status - Success

## DecisionTableAPI - deleteCondition(String conditionID) {#ariaid-title12}

Deletes a record in the Decision Conditions \[sn_decision_table_decision_condition\]
table.
{#DecisionTableAPI-deleteCond_S__table_apn_3yg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| conditionID | String | Sys_id of the decision condition record. Located in the Decision Conditions \[sn_decision_table_decision_condition\] table. |
[Table 20. Parameters]

{#DecisionTableAPI-deleteCond_S__table_apn_3yg_qvb} {#DecisionTableAPI-deleteCond_S__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-deleteCond_S__errors-message-entry}{#DecisionTableAPI-deleteCond_S__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-deleteCond_S__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-deleteCond_S__ul_lb5_3jm_svb} Data type: String |
[Table 21. Returns]

{#DecisionTableAPI-deleteCond_S__table_ps1_bgn_lvb}  
This example deletes a decision condition.

    var conditionID = 'c9530f4c3dc79910f8776a598af912f1';

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.deleteCondition(conditionID);
    gs.info('Status - ' + response.status);

Output:

    Status - Success

## DecisionTableAPI - deleteDecisionTable(String decisionID) {#ariaid-title13}

Deletes a record in the Decision Tables \[sys_decision\] table.
{#DecisionTableAPI-deleteDT_S__table_y3r_xxg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
[Table 22. Parameters]

{#DecisionTableAPI-deleteDT_S__table_y3r_xxg_qvb} {#DecisionTableAPI-deleteDT_S__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-deleteDT_S__errors-message-entry}{#DecisionTableAPI-deleteDT_S__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-deleteDT_S__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-deleteDT_S__ul_lb5_3jm_svb} Data type: String |
[Table 23. Returns]

{#DecisionTableAPI-deleteDT_S__table_ps1_bgn_lvb}  
This example deletes a decision table.

    var decisionID = 'a1f6e14c3d039910f8776a598af9129d';

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.deleteDecisionTable(decisionID);
    gs.info('Status -' + response.status);

Output:

    Status - Success

## DecisionTableAPI - deleteInput(String inputID) {#ariaid-title14}

Deletes a record in the Decision Inputs \[sys_decision_input\] table.
{#DecisionTableAPI-deleteInput_S__table_lql_pdd_rvb__entry__3}

| Name | Type | Description |
|-|-|-|
| inputID | String | Sys_id of the decision input record. Located in the Decision Inputs \[sys_decision_input\] table. |
[Table 24. Parameters]

{#DecisionTableAPI-deleteInput_S__table_lql_pdd_rvb} {#DecisionTableAPI-deleteInput_S__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-deleteInput_S__errors-message-entry}{#DecisionTableAPI-deleteInput_S__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-deleteInput_S__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-deleteInput_S__ul_lb5_3jm_svb} Data type: String |
[Table 25. Returns]

{#DecisionTableAPI-deleteInput_S__table_ps1_bgn_lvb}  
This example deletes a decision input.

    var inputID = 'a1f6e14c3d039910f8776a598af9129d';

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.deleteInput(inputID);
    gs.info('Status -' + response.status);

Output:

    Status - Success

## DecisionTableAPI - deleteQuestion(String questionID) {#ariaid-title15}

Deletes a record in the Decisions \[sys_decision_question\] table.
{#DecisionTableAPI-deleteQuestion_S__table_wbw_vyg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| questionID | String | Sys_id of the question record. Located in the Decisions \[sys_decision_question\] table. |
[Table 26. Parameters]

{#DecisionTableAPI-deleteQuestion_S__table_wbw_vyg_qvb} {#DecisionTableAPI-deleteQuestion_S__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-deleteQuestion_S__errors-message-entry}{#DecisionTableAPI-deleteQuestion_S__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-deleteQuestion_S__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-deleteQuestion_S__ul_lb5_3jm_svb} Data type: String |
[Table 27. Returns]

{#DecisionTableAPI-deleteQuestion_S__table_ps1_bgn_lvb}  
This example deletes a question.

    var questionId = '700602fe81d21110f87735acbca2c610';

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.deleteQuestion(questionId);
    gs.info('Status - ' + response.status);

Output:

    Status - Success

## DecisionTableAPI - getAll() {#ariaid-title16}

Returns all decision tables from the Decision Tables \[sys_decision\] table.
{#DecisionTableAPI-getAll__table_x44_ktc_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 28. Parameters]

{#DecisionTableAPI-getAll__table_x44_ktc_hhb} {#DecisionTableAPI-getAll__table_y44_ktc_hhb__entry__2}

| Type | Description |
|-|-|
| Object | All decision tables and their fields from the Decision Tables \[sys_decision\] table. Each decision table contains these key-value pairs: * distinctAnswers: Array. Answer records associated with the decision table. Each record contains these key-value pairs. * answerElementValues: Array. Answer element values associated with the answer record. Each record contains these key-value pairs: * answerElementName: String. Name of the answer element. * label: String. Answer record label. * table: String. Table of the answer element if the answer element is a Reference type. * type: String. Type of the answer element. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Value of the answer element. {#DecisionTableAPI-getAll__ul_qmf_l15_g5b} * label: String. Answer record label. * multipleAnswerRecord: Boolean. True if this is a multiple answer record; otherwise false. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Sys_id of the answer record. * table: String. Table containing the answer record. {#DecisionTableAPI-getAll__ul_ppz_npd_h3b} * referenceQualifier: String. Used for internal purposes. * inputs: Array. Decision inputs from the Decision Inputs \[sys_decision_input\] table associated with the decision table. Each record contains these key-value pairs. * searchField: String. Used for internal purposes. * defaultValue: String. Default value for the input. * show_ref_finder: Boolean. Used for internal purposes. * use_dependent: Boolean. Used for internal purposes. * type: String. Input data type. * mandatory: Boolean. True if the input is mandatory; otherwise false. * extended: Boolean. True if the input extends another field; otherwise false. * local: Boolean. Used for internal purposes. * sys_class_name: String. Used for internal purposes. * reference: String. Reference table used if the input type is reference. * dependent_on: String. Field that document ID and choice inputs depend on. * data_structure: String. Used for internal purposes. * readonly: Boolean. True if the input is read-only; otherwise false. * id: String. Sys_id of the input from the Decision Inputs \[sys_decision_input\] table. * type_label: String. Input data type label. * table: String. Reference field table if the input type is reference. * order: Number. Order in which the system evaluates inputs. * ref_qual: String. Condition applied to the reference table. * reference_display: String. Used for internal purposes. * choiceOption: String. Method for users to see a list of suggested values. * label: String. Label of the input record. * hint: String. Hint text used to help users understand the input required. * name: String. Internal name of the input record. * attributes: Array. Field attributes that apply to the input record. * maxsize: Number. Maximum number of characters allowed in the field. * columnName: String. Name of the input. {#DecisionTableAPI-getAll__ul_n4g_spd_h3b} * answerElements: Array. Answer elements from the Answer elements \[sys_decision_multi_result_element\] table associated with the decision table. Each record contains these key-value pairs. * searchField: String. Used for internal purposes. * defaultValue: String. Default value for the answer element. * show_ref_finder: Boolean. Used for internal purposes. * use_dependent: Boolean. Used for internal purposes. * type: String. Answer element data type. * mandatory: Boolean. True if the answer element is mandatory; otherwise false. * extended: Boolean. True if the answer element extends another field; otherwise false. * local: Boolean. Used for internal purposes. * sys_class_name: String. Used for internal purposes. * reference: String. Reference table used if the answer element type is reference. * dependent_on: String. Field that document ID and choice answer elements depend on. * data_structure: String. Used for internal purposes. * readonly: Boolean. True if the input is read-only; otherwise false. * id: String. Sys_id of the input from the Answer elements \[sys_decision_multi_result_element\] table. * type_label: String. Answer element data type label. * table: String. Reference field table if the answer element type is reference. * order: Number. Order of the answer elements. * ref_qual: String. Condition applied to the reference table. * reference_display: String. Used for internal purposes. * comments: Description of the answer element. * choiceOption: String. Method for users to see a list of suggested values. * label: String. Label of the answer element record. * hint: String. Hint text used to help users understand the answer element required. * name: String. Internal name of the answer element record. * attributes: Array. Field attributes that apply to the answer element record. * maxsize: Number. Maximum number of characters allowed in the field. * columnName: String. Name of the answer element. {#DecisionTableAPI-getAll__ul_eb2_wl1_h5b} * domain: String. Domain in which the decision table is visible. * answerType: String. Used for internal purposes. * questions: Array. Decision records from the Decision \[sys_decision_question\] table associated with the decision table. Decision records contain these key-value pairs. * defaultAnswer: Boolean. True if this decision is the default for the decision table; otherwise false. * condition: String. Conditions required to reach this decision. The fields available for the condition are the decision inputs that are associated with this decision table. * answer: Object. Answer record associated with the decision. Answer objects contain these key-value pairs. * answerElementValues: Array. Answer element values associated with the answer record. Each record contains these key-value pairs: * answerElementName: String. Name of the answer element. * label: String. Answer record label. * table: String. Table of the answer element if the answer element is a Reference type. * type: String. Type of the answer element. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Value of the answer element. {#DecisionTableAPI-getAll__d3558e68} * label: String. Answer record label. * multipleAnswerRecord: Boolean. True if this is a multiple answer record; otherwise false. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Sys_id of the answer record. * table: String. Table containing the answer record. {#DecisionTableAPI-getAll__ul_myc_2rd_h3b} * decisionTable: String. Sys_id of the decision table from the Decision Tables \[sys_decision\] table associated with the decision. * domain: String. Domain in which the decision is visible. * active: Boolean. True if the decision record is active; otherwise false. * id: String. Sys_id of the decision record from the Decision \[sys_decision_question\] table. * label: String. Label for the decision record. * order: Number. Order in which the system evaluates decisions. {#DecisionTableAPI-getAll__ul_t4r_nyd_h3b} * accessibleFrom: String. Scopes that have access to the record. * name: String. Internal name of the decision table record. * active: Boolean. True if the decision table record is active; otherwise false. * multipleAnswerSupported: Boolean. True if the decision table support multiple answers; otherwise false. * id: String. Sys_id of the decision table record. * label: String. Label of the decision table record. * answerTable: Object. Answer table associated with the decision table. * displayValue: String. Display name of the table that contains answer records. * value: String. Internal name of the table that contains answer records. {#DecisionTableAPI-getAll__ul_isq_2sd_h3b} * conditions: Array. Conditions in the Decision \[sys_decision_question_list\] table. Applicable only for decision tables created or edited in Decision Builder. Each entry contains the following key value pairs. * decisionInput: String. Sys_id of the corresponding decision input. Listed in the Decision Inputs \[sys_decision_input\] table. * sysId: String. Sys_id of the condition record. * defaultOperator: String. Default operator for the condition. * typeName: String. Name of the condition type. * description: String. Description of the condition. * label: String. Label of the condition. * type: String. Sys_id of the condition type. * reference: String. Reference table used if the condition type is reference. * field: String. Field of the condition if the condition is dot-walked from an input of type reference. * decisionTable: String. Sys_id of the decision table from the Decision Tables \[sys_decision\] table. * fieldLabel: String. Field label of the condition if the condition is dot-walked from an input of type reference. * scope: String. Scope of the condition. * domain: String. Domain in which the condition is visible. * typeLabel: String. Label of the condition type. * fieldParentTable: Table name of the condition field. Value returns if the condition is dot-walked to a non-reference field from a reference input. * order: Number. Order of the condition. {#DecisionTableAPI-getAll__ul_igh_hvw_h5b} {#DecisionTableAPI-getAll__ul_vvz_psd_h3b} Format: JSON |
[Table 29. Returns]

{#DecisionTableAPI-getAll__table_y44_ktc_hhb}  

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.getAll();
    gs.info(JSON.stringify(response));

Output:

    {"result": [
      {
        "distinctAnswers": [{
          "valid": true,
          "label": "Assignment Group Manager Approval",
          "value": "5684821db701230034d1da23ee11a94d",
          "table": "chg_approval_def"
        }],
        "referenceQualifier": "",
        "inputs": [
          {
            "searchField": null,
            "defaultValue": "0",
            "show_ref_finder": false,
            "use_dependent": false,
            "type": "integer",
            "mandatory": false,
            "extended": false,
            "local": false,
            "sys_class_name": "",
            "reference": "",
            "dependent_on": "",
            "data_structure": "",
            "readonly": false,
            "id": "eca52ca7b701230034d1da23ee11a95a",
            "type_label": "Integer",
            "table": "",
            "order": 100,
            "ref_qual": "",
            "reference_display": "",
            "choiceOption": "",
            "label": "CI Count",
            "hint": "",
            "name": "ci_count",
            "attributes": {"element_mapping_provider": "com.glide.decision_table.data.DecisionTableVariableMapper"},
            "maxsize": 40,
            "columnName": ""
          },
          {
            "searchField": "number",
            "defaultValue": "",
            "show_ref_finder": false,
            "use_dependent": false,
            "type": "reference",
            "mandatory": false,
            "extended": false,
            "local": false,
            "sys_class_name": "",
            "reference": "change_request",
            "dependent_on": "",
            "data_structure": "",
            "readonly": false,
            "id": "1395e8a7b701230034d1da23ee11a9b6",
            "type_label": "Reference",
            "table": "",
            "order": 100,
            "ref_qual": "",
            "reference_display": "Change Request",
            "choiceOption": "",
            "label": "Change request",
            "hint": "",
            "name": "change_request",
            "attributes": {"element_mapping_provider": "com.glide.decision_table.data.DecisionTableVariableMapper"},
            "maxsize": 32,
            "columnName": ""
          }
        ],
        "domain": "global",
        "answerType": "reference",
        "questions": [{
          "defaultAnswer": false,
          "condition": "ci_count>=1000^EQ",
          "answer": {
            "valid": true,
            "label": "Assignment Group Manager Approval",
            "value": "5684821db701230034d1da23ee11a94d",
            "table": "chg_approval_def"
          },
          "decisionTable": "e49568a7b701230034d1da23ee11a913",
          "domain": "global",
          "active": true,
          "state": null,
          "id": "2a36eca7b701230034d1da23ee11a961",
          "label": "Mandatory Approval if 1000 CIs or more",
          "order": 0
        }],
        "accessibleFrom": "public",
        "name": "Example Standard Change Policy",
        "active": true,
        "id": "e49568a7b701230034d1da23ee11a913",
        "label": "",
        "answerTable": {
          "displayValue": "Change Approval Definition",
          "value": "chg_approval_def"
        }
      },
      {
        "distinctAnswers": [
          {
            "valid": true,
            "label": "CAB Approval",
            "value": "45358a5db701230034d1da23ee11a938",
            "table": "chg_approval_def"
          },
          {
            "valid": true,
            "label": "Assignment Group Manager Approval",
            "value": "5684821db701230034d1da23ee11a94d",
            "table": "chg_approval_def"
          },
          {
            "valid": true,
            "label": "Assignment Group Approval",
            "value": "dc95ca5db701230034d1da23ee11a9e9",
            "table": "chg_approval_def"
          }
        ],
        "referenceQualifier": "",
        "inputs": [
          {
            "searchField": null,
            "defaultValue": "false",
            "show_ref_finder": false,
            "use_dependent": false,
            "type": "boolean",
            "mandatory": false,
            "extended": false,
            "local": false,
            "sys_class_name": "",
            "reference": "",
            "dependent_on": "",
            "data_structure": "",
            "readonly": false,
            "id": "c0a7869db701230034d1da23ee11a9e7",
            "type_label": "True/False",
            "table": "",
            "order": 100,
            "ref_qual": "",
            "reference_display": "",
            "choiceOption": "",
            "label": "Manager approved",
            "hint": "",
            "name": "manager_approved",
            "attributes": {"element_mapping_provider": "com.glide.decision_table.data.DecisionTableVariableMapper"},
            "maxsize": 40,
            "columnName": ""
          },
          {
            "searchField": "number",
            "defaultValue": "",
            "show_ref_finder": false,
            "use_dependent": false,
            "type": "reference",
            "mandatory": false,
            "extended": false,
            "local": false,
            "sys_class_name": "",
            "reference": "change_request",
            "dependent_on": "",
            "data_structure": "",
            "readonly": false,
            "id": "23164e5db701230034d1da23ee11a9c5",
            "type_label": "Reference",
            "table": "",
            "order": 100,
            "ref_qual": "",
            "reference_display": "Change Request",
            "choiceOption": "",
            "label": "Change request",
            "hint": "",
            "name": "change_request",
            "attributes": {"element_mapping_provider": "com.glide.decision_table.data.DecisionTableVariableMapper"},
            "maxsize": 32,
            "columnName": ""
          }
        ],
        "domain": "global",
        "answerType": "reference",
        "questions": [
          {
            "defaultAnswer": false,
            "condition": "change_request.state=-3^change_request.riskIN2,3^NQchange_request.state=-3^change_request.assignment_group.managerISEMPTY^EQ",
            "answer": {
              "valid": true,
              "label": "CAB Approval",
              "value": "45358a5db701230034d1da23ee11a938",
              "table": "chg_approval_def"
            },
            "decisionTable": "5b06ce5db701230034d1da23ee11a965",
            "domain": "global",
            "active": true,
            "state": null,
            "id": "10284a9db701230034d1da23ee11a9c1",
            "label": "Requires CAB Approval",
            "order": 0
          },
          {
            "defaultAnswer": false,
            "condition": "change_request.state=-3^change_request.risk=4^manager_approved=false^EQ",
            "answer": {
              "valid": true,
              "label": "Assignment Group Manager Approval",
              "value": "5684821db701230034d1da23ee11a94d",
              "table": "chg_approval_def"
            },
            "decisionTable": "5b06ce5db701230034d1da23ee11a965",
            "domain": "global",
            "active": true,
            "state": null,
            "id": "88e6829db701230034d1da23ee11a9a9",
            "label": "Low Risk Manager approval",
            "order": 0
          },
          {
            "defaultAnswer": false,
            "condition": "change_request.state=-4^EQ",
            "answer": {
              "valid": true,
              "label": "Assignment Group Approval",
              "value": "dc95ca5db701230034d1da23ee11a9e9",
              "table": "chg_approval_def"
            },
            "decisionTable": "5b06ce5db701230034d1da23ee11a965",
            "domain": "global",
            "active": true,
            "state": null,
            "id": "a436029db701230034d1da23ee11a989",
            "label": "Assess Technical Approvals",
            "order": 0
          }
        ],
        "accessibleFrom": "public",
        "name": "Normal Change Policy",
        "active": true,
        "id": "5b06ce5db701230034d1da23ee11a965",
        "label": "",
        "answerTable": {
          "displayValue": "Change Approval Definition",
          "value": "chg_approval_def"
        }
      },
     
    ]}

## DecisionTableAPI - getAnswers(String decisionID) {#ariaid-title17}

Returns the answers associated with the specified decision table. An answer is a record
on any table associated with a Decision \[sys_decision_question\] record.
{#DecisionTableAPI-getAnswers_S__table_ohm_m5c_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the Decision Table record from the Decision Tables \[sys_decision\] table. |
[Table 30. Parameters]

{#DecisionTableAPI-getAnswers_S__table_ohm_m5c_hhb} {#DecisionTableAPI-getAnswers_S__table_phm_m5c_hhb__entry__2}

| Type | Description |
|-|-|
| Object | Answer records associated with the decision table. Each record contains these key-value pairs: * answerElementValues: Array. Answer element values associated with the answer record. Each record contains these key-value pairs: * answerElementName: String. Name of the answer element. * label: String. Answer record label. * table: String. Table of the answer element if the answer element is a Reference type. * type: String. Type of the answer element. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Value of the answer element. {#DecisionTableAPI-getAnswers_S__ul_qmf_l15_g5b} * label: String. Answer record label. * multipleAnswerRecord: Boolean. True if this is a multiple answer record; otherwise false. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Sys_id of the answer record. * table: String. Table containing the answer record. {#DecisionTableAPI-getAnswers_S__ul_b1t_y2b_f5b} Format: JSON |
[Table 31. Returns]

{#DecisionTableAPI-getAnswers_S__table_phm_m5c_hhb}  

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.getAnswers("3c4464a7b701230034d1da23ee11a993");
    gs.info(JSON.stringify(response));

Output:

    {
     "result": [
      {
       "answerElementValues": [
        {
         "valid": true,
         "answerElementName": "u_user",
         "label": "Abel Tuter",
         "value": "62826bf03710200044e0bfc8bcbe5df1",
         "table": "sys_user"
       }],
      "valid": true,
      "multipleAnswerRecord": true,
      "label": "User: Abel Tuter",
      "value": "76e19cd953d7011097a3ddeeff7b122c",
      "table": "sys_decision_multi_result"
      },
     ]
    }

## DecisionTableAPI - getDecision(String decisionID, Map inputs) {#ariaid-title18}

Evaluates a decision table based on the provided inputs and returns an answer. If no
inputs are provided, returns the first default answer found.
{#DecisionTableAPI-getDecision_S_O__table_e3m_w5c_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the Decision Table record from the Decision Tables \[sys_decision\] table. |
| inputs | Map | Optional. Input values for the Decision Inputs \[sys_decision_input\] table associated with the provided decision table. Use the value of the Column name field as the key. The data type of the value must match the Decision Input Type field. If no inputs are provided, returns the first default answer found. Note: All inputs and column names must follow the following format: * be all lower case and prefixed with a `u_` * blank spaces are replaced with `_` {#DecisionTableAPI-getDecision_S_O__ul_vfj_dwk_3yb} For example, * Input name: Incident * Input technical name: u_incident * Result column name: Assignment Group * Result column technical name: u_assignment_group {#DecisionTableAPI-getDecision_S_O__ul_mhb_3wk_3yb} For more information, see [Make Decisions from JavaScript with the DecisionTableAPI - Workflow Automation CoE](https://www.servicenow.com/community/workflow-automation-articles/make-decisions-from-javascript-with-the-decisiontableapi/ta-p/2620035) |
[Table 32. Parameters]

{#DecisionTableAPI-getDecision_S_O__table_e3m_w5c_hhb} {#DecisionTableAPI-getDecision_S_O__table_f3m_w5c_hhb__entry__2}

| Type | Description |
|-|-|
| GlideRecord | The correctly evaluated Answer record associated with the decision table. An answer record is a record from the table defined in the Decision \[sys_decision_question\] record Answer table field. * If no inputs are provided, returns the first default answer found. If no default or correctly evaluated answers are found, returns an error. * If the decision table supports multiple answers, each answer is listed in the result_elements field. {#DecisionTableAPI-getDecision_S_O__ul_z5z_v3b_f5b} |
[Table 33. Returns]

{#DecisionTableAPI-getDecision_S_O__table_f3m_w5c_hhb}  

    var dt = new sn_dt.DecisionTableAPI();
    var inputs = new Object();
    inputs['u_age'] = 25;
    var response = dt.getDecision('26eea7a9dba07300efc65404ce961961', inputs);
    var user = response.result_elements.u_user;

## DecisionTableAPI - getDecisions(String decisionID, Map inputs) {#ariaid-title19}

Evaluates a decision table based on the provided inputs and returns all correctly
evaluated answers. If no inputs are provided, returns all default answers.
{#DecisionTableAPI-getDecisions_S_O__table_e3m_w5c_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the Decision Table record from the Decision Tables \[sys_decision\] table. |
| inputs | Map | Optional. Input values for the Decision Inputs \[sys_decision_input\] table associated with the provided decision table. If no inputs are provided, returns all default answers. Note: All inputs and column names must follow the following format: * be all lower case and prefixed with a `u_` * blank spaces are replaced with `_` {#DecisionTableAPI-getDecisions_S_O__ul_vfj_dwk_3yb} For example, * Input name: Incident * Input technical name: u_incident * Result column name: Assignment Group * Result column technical name: u_assignment_group {#DecisionTableAPI-getDecisions_S_O__ul_mhb_3wk_3yb} For more information, see [Make Decisions from JavaScript with the DecisionTableAPI - Workflow Automation CoE](https://www.servicenow.com/community/workflow-automation-articles/make-decisions-from-javascript-with-the-decisiontableapi/ta-p/2620035) |
[Table 34. Parameters]

{#DecisionTableAPI-getDecisions_S_O__table_e3m_w5c_hhb} {#DecisionTableAPI-getDecisions_S_O__table_tg2_y5c_hhb__entry__2}

| Type | Description |
|-|-|
| Array | List of answer records in GlideRecord format. An answer record is a record on any table associated with a Decision \[sys_decision_question\] record. * If no inputs are provided, returns all default answers. * If no default or correctly evaluated answers are found, returns an error. * If the decision table supports multiple answers, each answer is listed in the result_elements field. {#DecisionTableAPI-getDecisions_S_O__ul_ppr_2l1_f5b} |
[Table 35. Returns]

{#DecisionTableAPI-getDecisions_S_O__table_tg2_y5c_hhb}  

    var dt = new sn_dt.DecisionTableAPI();
    var input = new Object();
    input['u_age'] = 25;
    var response = dt.getDecisions('5b06ce5db701230034d1da23ee11a965', input);
    var firstRecord = response[0];
    var user = firstRecord.result_elements.u_user;

## DecisionTableAPI - getDecisionTable(String decisionID) {#ariaid-title20}

Returns a single decision table from the Decision Tables \[sys_decision\]
table.
{#DecisionTableAPI-getDecisionTable_S__table_a3y_g5c_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the Decision Table record from the Decision Tables \[sys_decision\] table. |
[Table 36. Parameters]

{#DecisionTableAPI-getDecisionTable_S__table_a3y_g5c_hhb} {#DecisionTableAPI-getDecisionTable_S__table_b3y_g5c_hhb__entry__2}

| Type | Description |
|-|-|
| Object | Decision table from the Decision Tables \[sys_decision\] table. Each decision table contains these key-value pairs. * distinctAnswers: Array. Answer records associated with the decision table. Each record contains these key-value pairs. * answerElementValues: Array. Answer element values associated with the answer record. Each record contains these key-value pairs: * answerElementName: String. Name of the answer element. * label: String. Answer record label. * table: String. Table of the answer element if the answer element is a Reference type. * type: String. Type of the answer element. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Value of the answer element. {#DecisionTableAPI-getDecisionTable_S__ul_qmf_l15_g5b} * label: String. Answer record label. * multipleAnswerRecord: Boolean. True if this is a multiple answer record; otherwise false. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Sys_id of the answer record. * table: String. Table containing the answer record. {#DecisionTableAPI-getDecisionTable_S__ul_ppz_npd_h3b} * referenceQualifier: String. Used for internal purposes. * inputs: Array. Decision inputs from the Decision Inputs \[sys_decision_input\] table associated with the decision table. Each record contains these key-value pairs. * searchField: String. Used for internal purposes. * defaultValue: String. Default value for the input. * show_ref_finder: Boolean. Used for internal purposes. * use_dependent: Boolean. Used for internal purposes. * type: String. Input data type. * mandatory: Boolean. True if the input is mandatory; otherwise false. * extended: Boolean. True if the input extends another field; otherwise false. * local: Boolean. Used for internal purposes. * sys_class_name: String. Used for internal purposes. * reference: String. Reference table used if the input type is reference. * dependent_on: String. Field that document ID and choice inputs depend on. * data_structure: String. Used for internal purposes. * readonly: Boolean. True if the input is read-only; otherwise false. * id: String. Sys_id of the input from the Decision Inputs \[sys_decision_input\] table. * type_label: String. Input data type label. * table: String. Reference field table if the input type is reference. * order: Number. Order in which the system evaluates inputs. * ref_qual: String. Condition applied to the reference table. * reference_display: String. Used for internal purposes. * choiceOption: String. Method for users to see a list of suggested values. * label: String. Label of the input record. * hint: String. Hint text used to help users understand the input required. * name: String. Internal name of the input record. * attributes: Array. Field attributes that apply to the input record. * maxsize: Number. Maximum number of characters allowed in the field. * columnName: String. Name of the input. {#DecisionTableAPI-getDecisionTable_S__ul_n4g_spd_h3b} * answerElements: Array. Answer elements from the Answer elements \[sys_decision_multi_result_element\] table associated with the decision table. Each record contains these key-value pairs. * searchField: String. Used for internal purposes. * defaultValue: String. Default value for the answer element. * show_ref_finder: Boolean. Used for internal purposes. * use_dependent: Boolean. Used for internal purposes. * type: String. Answer element data type. * mandatory: Boolean. True if the answer element is mandatory; otherwise false. * extended: Boolean. True if the answer element extends another field; otherwise false. * local: Boolean. Used for internal purposes. * sys_class_name: String. Used for internal purposes. * reference: String. Reference table used if the answer element type is reference. * dependent_on: String. Field that document ID and choice answer elements depend on. * data_structure: String. Used for internal purposes. * readonly: Boolean. True if the input is read-only; otherwise false. * id: String. Sys_id of the input from the Answer elements \[sys_decision_multi_result_element\] table. * type_label: String. Answer element data type label. * table: String. Reference field table if the answer element type is reference. * order: Number. Order of the answer elements. * ref_qual: String. Condition applied to the reference table. * reference_display: String. Used for internal purposes. * comments: Description of the answer element. * choiceOption: String. Method for users to see a list of suggested values. * label: String. Label of the answer element record. * hint: String. Hint text used to help users understand the answer element required. * name: String. Internal name of the answer element record. * attributes: Array. Field attributes that apply to the answer element record. * maxsize: Number. Maximum number of characters allowed in the field. * columnName: String. Name of the answer element. {#DecisionTableAPI-getDecisionTable_S__ul_eb2_wl1_h5b} * domain: String. Domain in which the decision table is visible. * answerType: String. Used for internal purposes. * questions: Array. Decision records from the Decision \[sys_decision_question\] table associated with the decision table. Decision records contain these key-value pairs. * defaultAnswer: Boolean. True if this decision is the default for the decision table; otherwise false. * condition: String. Conditions required to reach this decision. The fields available for the condition are the decision inputs that are associated with this decision table. * answer: Object. Answer record associated with the decision. Answer objects contain these key-value pairs. * answerElementValues: Array. Answer element values associated with the answer record. Each record contains these key-value pairs: * answerElementName: String. Name of the answer element. * label: String. Answer record label. * table: String. Table of the answer element if the answer element is a Reference type. * type: String. Type of the answer element. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Value of the answer element. {#DecisionTableAPI-getDecisionTable_S__d3558e68} * label: String. Answer record label. * multipleAnswerRecord: Boolean. True if this is a multiple answer record; otherwise false. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Sys_id of the answer record. * table: String. Table containing the answer record. {#DecisionTableAPI-getDecisionTable_S__ul_myc_2rd_h3b} * decisionTable: String. Sys_id of the decision table from the Decision Tables \[sys_decision\] table associated with the decision. * domain: String. Domain in which the decision is visible. * active: Boolean. True if the decision record is active; otherwise false. * id: String. Sys_id of the decision record from the Decision \[sys_decision_question\] table. * label: String. Label for the decision record. * order: Number. Order in which the system evaluates decisions. {#DecisionTableAPI-getDecisionTable_S__ul_t4r_nyd_h3b} * accessibleFrom: String. Scopes that have access to the record. * name: String. Internal name of the decision table record. * active: Boolean. True if the decision table record is active; otherwise false. * multipleAnswerSupported: Boolean. True if the decision table support multiple answers; otherwise false. * id: String. Sys_id of the decision table record. * label: String. Label of the decision table record. * answerTable: Object. Answer table associated with the decision table. * displayValue: String. Display name of the table that contains answer records. * value: String. Internal name of the table that contains answer records. {#DecisionTableAPI-getDecisionTable_S__ul_isq_2sd_h3b} * conditions: Array. Conditions in the Decision \[sys_decision_question_list\] table. Applicable only for decision tables created or edited in Decision Builder. Each entry contains the following key value pairs. * decisionInput: String. Sys_id of the corresponding decision input. Listed in the Decision Inputs \[sys_decision_input\] table. * sysId: String. Sys_id of the condition record. * defaultOperator: String. Default operator for the condition. * typeName: String. Name of the condition type. * description: String. Description of the condition. * label: String. Label of the condition. * type: String. Sys_id of the condition type. * reference: String. Reference table used if the condition type is reference. * field: String. Field of the condition if the condition is dot-walked from an input of type reference. * decisionTable: String. Sys_id of the decision table from the Decision Tables \[sys_decision\] table. * fieldLabel: String. Field label of the condition if the condition is dot-walked from an input of type reference. * scope: String. Scope of the condition. * domain: String. Domain in which the condition is visible. * typeLabel: String. Label of the condition type. * fieldParentTable: Table name of the condition field. Value returns if the condition is dot-walked to a non-reference field from a reference input. * order: Number. Order of the condition. {#DecisionTableAPI-getDecisionTable_S__ul_igh_hvw_h5b} {#DecisionTableAPI-getDecisionTable_S__ul_tjj_5pd_h3b} Format: JSON |
[Table 37. Returns]

{#DecisionTableAPI-getDecisionTable_S__table_b3y_g5c_hhb}  

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.getDecisionTable("3c4464a7b701230034d1da23ee11a993");
    gs.info(JSON.stringify(response));

Output:

    "distinctAnswers": [{
        "valid": true,
        "label": "CAB Approval",
        "value": "45358a5db701230034d1da23ee11a938",
        "table": "chg_approval_def"
      }],
      "referenceQualifier": "",
      "inputs": [{
        "searchField": "number",
        "defaultValue": "",
        "show_ref_finder": false,
        "use_dependent": false,
        "type": "reference",
        "mandatory": false,
        "extended": false,
        "local": false,
        "sys_class_name": "",
        "reference": "change_request",
        "dependent_on": "",
        "data_structure": "",
        "readonly": false,
        "id": "634420a7b701230034d1da23ee11a94f",
        "type_label": "Reference",
        "table": "",
        "order": 100,
        "ref_qual": "",
        "reference_display": "Change Request",
        "choiceOption": "",
        "label": "Change request",
        "hint": "",
        "name": "change_request",
        "attributes": {"element_mapping_provider": "com.glide.decision_table.data.DecisionTableVariableMapper"},
        "maxsize": 32,
        "columnName": ""
      }],
      "domain": "global",
      "answerType": "reference",
      "questions": [{
        "defaultAnswer": true,
        "condition": "change_request.state=-3^EQ",
        "answer": {
          "valid": true,
          "label": "CAB Approval",
          "value": "45358a5db701230034d1da23ee11a938",
          "table": "chg_approval_def"
        },
        "decisionTable": "3c4464a7b701230034d1da23ee11a993",
        "domain": "global",
        "active": true,
        "state": null,
        "id": "2764a4a7b701230034d1da23ee11a989",
        "label": "Requires CAB Approval",
        "order": 0
      }],
      "accessibleFrom": "public",
      "name": "Emergency Change Policy",
      "active": true,
      "id": "3c4464a7b701230034d1da23ee11a993",
      "label": "",
      "answerTable": {
        "displayValue": "Change Approval Definition",
        "value": "chg_approval_def"
      }
    }

## DecisionTableAPI - getInputs(String decisionID) {#ariaid-title21}

Returns the decision inputs from the Decision Inputs \[sys_decision_input\] table
associated with the passed in decision table.
{#DecisionTableAPI-getInputs_S__table_u5w_35c_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the Decision Table record from the Decision Tables \[sys_decision\] table. |
[Table 38. Parameters]

{#DecisionTableAPI-getInputs_S__table_u5w_35c_hhb} {#DecisionTableAPI-getInputs_S__table_v5w_35c_hhb__entry__2}

| Type | Description |
|-|-|
| Object | Decision inputs from the Decision Inputs \[sys_decision_input\] table associated with the decision table. You can find the inputs associated with a decision table using the Decision Inputs related list in the Decision Tables \[sys_decision\] table. Inputs contain these key-value pairs. * searchField: String. Used for internal purposes. * defaultValue: String. Default value for the input. * show_ref_finder: Boolean. Used for internal purposes. * use_dependent: Boolean. Used for internal purposes. * type: String. Input data type. * mandatory: Boolean. True if the input is mandatory; otherwise false. * extended: Boolean. True if the input extends another field; otherwise false. * local: Boolean. Used for internal purposes. * sys_class_name: String. Used for internal purposes. * reference: String. Reference table used if the input type is reference. * dependent_on: String. Field that document ID and choice inputs depend on. * data_structure: String. Used for internal purposes. * readonly: Boolean. True if the input is read-only; otherwise false. * id: String. Sys_id of the input from the Decision Inputs \[sys_decision_input\] table. * type_label: String. Input data type label. * table: String. Reference field table if the input type is reference. * order: Number. Order in which the system evaluates inputs. * ref_qual: String. Condition applied to the reference table. * reference_display: String. Used for internal purposes. * choiceOption: String. Method for users to see a list of suggested values. * label: String. Label of the input record. * hint: String. Hint text used to help users understand the input required. * name: String. Internal name of the input record. * attributes: Array. Field attributes that apply to the input record. * maxsize: Number. Maximum number of characters allowed in the field. * columnName: String. Name of the input. {#DecisionTableAPI-getInputs_S__ul_t5m_nfd_h3b} Format: JSON |
[Table 39. Returns]

{#DecisionTableAPI-getInputs_S__table_v5w_35c_hhb}  

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.getInputs("3c4464a7b701230034d1da23ee11a993");
    gs.info(JSON.stringify(response));

Output:

    {"result": [{
      "searchField": "number",
      "defaultValue": "",
      "show_ref_finder": false,
      "use_dependent": false,
      "type": "reference",
      "mandatory": false,
      "extended": false,
      "local": false,
      "sys_class_name": "",
      "reference": "change_request",
      "dependent_on": "",
      "data_structure": "",
      "readonly": false,
      "id": "634420a7b701230034d1da23ee11a94f",
      "type_label": "Reference",
      "table": "",
      "order": 100,
      "ref_qual": "",
      "reference_display": "Change Request",
      "choiceOption": "",
      "label": "Change request",
      "hint": "",
      "name": "change_request",
      "attributes": {"element_mapping_provider": "com.glide.decision_table.data.DecisionTableVariableMapper"},
      "maxsize": 32,
      "columnName": ""
    }]}

## DecisionTableAPI - getQuestions(String decisionID) {#ariaid-title22}

Returns the decisions from the Decision \[sys_decision_question\] table associated with
the passed in decision table.
{#DecisionTableAPI-getQuestions_S__table_yjb_l5c_hhb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the Decision Table record from the Decision Tables \[sys_decision\] table. |
[Table 40. Parameters]

{#DecisionTableAPI-getQuestions_S__table_yjb_l5c_hhb} {#DecisionTableAPI-getQuestions_S__table_zjb_l5c_hhb__entry__2}

| Type | Description |
|-|-|
| Object | Decisions from the Decision \[sys_decision_question\] table associated with the decision table. You can find the decisions associated with a decision table using the Decisions related list in the Decision Tables \[sys_decision\] table. Decision records contain these key-value pairs. * defaultAnswer: Boolean. True if this decision is the default for the decision table; otherwise false. * condition: String. Conditions required to reach this decision. The fields available for the condition are the decision inputs that are associated with this decision table. * answer: Object. Answer record associated with the decision. Answer objects contain these key-value pairs. * answerElementValues: Array. Answer element values associated with the answer record. Each record contains these key-value pairs: * answerElementName: String. Name of the answer element. * label: String. Answer record label. * table: String. Table of the answer element if the answer element is a Reference type. * type: String. Type of the answer element. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Value of the answer element. {#DecisionTableAPI-getQuestions_S__ul_qmf_l15_g5b} * label: String. Answer record label. * multipleAnswerRecord: Boolean. True if this is a multiple answer record; otherwise false. * valid: Boolean. True if the record exists in the system; otherwise false. * value: String. Sys_id of the answer record. * table: String. Table containing the answer record. {#DecisionTableAPI-getQuestions_S__ul_myc_2rd_h3b} * decisionTable: String. Sys_id of the decision table from the Decision Tables \[sys_decision\] table associated with the decision. * domain: String. Domain in which the decision is visible. * active: Boolean. True if the decision record is active; otherwise false. * id: String. Sys_id of the decision record from the Decision \[sys_decision_question\] table. * label: String. Label for the decision record. * order: Number. Order in which the system evaluates decisions. {#DecisionTableAPI-getQuestions_S__ul_dhg_wsd_h3b} Format: JSON |
[Table 41. Returns]

{#DecisionTableAPI-getQuestions_S__table_zjb_l5c_hhb}  

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.getQuestions("3c4464a7b701230034d1da23ee11a993");
    gs.info(JSON.stringify(response));

Output:

    {"result": [{
      "defaultAnswer": true,
      "condition": "change_request.state=-3^EQ",
      "answer": {
        "valid": true,
        "label": "CAB Approval",
        "value": "45358a5db701230034d1da23ee11a938",
        "table": "chg_approval_def"
      },
      "decisionTable": "3c4464a7b701230034d1da23ee11a993",
      "domain": "global",
      "active": true,
      "state": null,
      "id": "2764a4a7b701230034d1da23ee11a989",
      "label": "Requires CAB Approval",
      "order": 0
    }]}

## DecisionTableAPI - updateAnswerElement(String answerElementID, Object
answerElement) {#ariaid-title23}

Updates a record in the Result \[sys_decision_multi_result_element\]
table.
{#DecisionTableAPI-updateAnsEl_S_O__table_bzf_nyg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| answerElementID | String | Sys_id of the answer element record. Located in the Result Elements \[sys_decision_multi_result_element\] table. |
| answerElement | Object | Key-value pairs to update the answer element record. { comments: "String", label: "String", maxsize: Number } |
| answerElement.comments | String | Optional. Description of the answer element. |
| answerElement.label | String | Optional. Label of the answer element record. |
| answerElement.maxsize | Number | Optional. Maximum number of characters allowed in the answer element field. Use this property only if answerElement.type is `String`. |
[Table 42. Parameters]

{#DecisionTableAPI-updateAnsEl_S_O__table_bzf_nyg_qvb} {#DecisionTableAPI-updateAnsEl_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-updateAnsEl_S_O__errors-message-entry}{#DecisionTableAPI-updateAnsEl_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "record": GlideRecord, "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-updateAnsEl_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.record | GlideRecord reference to the answer element updated in the Result Elements \[sys_decision_multi_result_element\] table. Data type: GlideRecord |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-updateAnsEl_S_O__ul_lb5_3jm_svb} Data type: String |
[Table 43. Returns]

{#DecisionTableAPI-updateAnsEl_S_O__table_ps1_bgn_lvb}  
This example updates the label and comments for an answer element.

    var answerElementID = '51c707803d0b9910f8776a598af91217';
    var answerElement = {
       label: 'Product',	
       comments: 'hello'
    };

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.updateAnswerElement(answerElementID, answerElement);
    gs.info('Status - ' + response.status);
    gs.info('Result Element label changed to - ' + response.record.getValue('label'));

Output:

    Status - Success
    Result Element label changed to - Product

## DecisionTableAPI - updateChoice (String choiceID, Object choice) {#ariaid-title24}

Updates a record in the Choices \[sys_choice\] table.
{#DecisionTableAPI-updateChoice_S_O__table_zcq_rzg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| choiceID | String | Sys_id of the choice record. Located in the Choices \[sys_choice\] table. |
| choice | Object | Key-value pairs to update the choice record. { label: "String", order: Number, value: "String" } |
| choice.label | String | Optional. Label of the choice. |
| choice.order | Number | Optional. Order of the choice. |
| choice.value | String | Optional. Value of the choice. |
[Table 44. Parameters]

{#DecisionTableAPI-updateChoice_S_O__table_zcq_rzg_qvb} {#DecisionTableAPI-updateChoice_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-updateChoice_S_O__errors-message-entry}{#DecisionTableAPI-updateChoice_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "record": GlideRecord, "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-updateChoice_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.record | GlideRecord reference to the choice updated in the Choices \[sys_choice\] table. Data type: GlideRecord |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-updateChoice_S_O__ul_lb5_3jm_svb} Data type: String |
[Table 45. Returns]

{#DecisionTableAPI-updateChoice_S_O__table_ps1_bgn_lvb}  
This example updates the label, value, and order for a choice.

    var choiceID = '4532db883d0b9910f8776a598af912e7';
    var choices = {
       label: 'Delhi',
       value: 'del',
       order: 50
    };

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.updateChoice(choiceID, choices);
    gs.info('Status - ' + response.status);

Output:

    Status - Success

## DecisionTableAPI - updateCondition(String conditionID, Object condition) {#ariaid-title25}

Updates a record in the Decision Conditions \[sn_decision_table_decision_condition\]
table.
{#DecisionTableAPI-updateCond_S_O__table_rrf_hyg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| conditionID | String | Sys_id of the decision condition record. Located in the Decision Conditions \[sn_decision_table_decision_condition\] table. |
| condition | Object | Key-value pairs to update the decision condition record. { defaultOperator: "String", description: "String", label: "String" } |
| condition.defaultOperator | String | Optional. Default operator for the condition. For a list of valid operators, see [Operators available for filters and queries](https://www.servicenow.com/docs/access?context=r_OpAvailableFiltersQueries&version=xanadu&pubname=xanadu-platform-user-interface&ft:locale=en-US). |
| condition.description | String | Optional. Description of the condition. |
| condition.label | String | Optional. Label of the decision condition record. |
[Table 46. Parameters]

{#DecisionTableAPI-updateCond_S_O__table_rrf_hyg_qvb} {#DecisionTableAPI-updateCond_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-updateCond_S_O__errors-message-entry}{#DecisionTableAPI-updateCond_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "record": GlideRecord, "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-updateCond_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.record | GlideRecord reference to the decision condition updated in the Decision Conditions \[sn_decision_table_decision_condition\] table. Data type: GlideRecord |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-updateCond_S_O__ul_lb5_3jm_svb} Data type: String |
[Table 47. Returns]

{#DecisionTableAPI-updateCond_S_O__table_ps1_bgn_lvb}  
This example updates a decision condition.

    var conditionID = 'c9530f4c3dc79910f8776a598af912f1';
    var condition = {
       defaultOperator: '!=',
       label: 'Active Incident',
       description: 'Check if the incident is active'
    };

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.updateCondition(conditionID, condition);
    gs.info('Status - ' + response.status);
    gs.info('Condition label changed to - ' + response.record.getValue('label'));

Output:

    Status - Success
    Condition label changed to - Active Incident

## DecisionTableAPI - updateDecisionTable(String decisionID, Object decisionTable) {#ariaid-title26}

Updates a record in the Decision Tables \[sys_decision\] table.
{#DecisionTableAPI-updateDT_S_O__table_pnx_vxg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| decisionID | String | Sys_id of the decision table record. Located in the Decision Tables \[sys_decision\] table. |
| decisionTable | Object | Key-value pairs to update the decision table record. { "accessibleFrom": "String", "name": "String" } |
| decisionTable.accessibleFrom | String | Optional. Scopes that have access to the decision table record. Valid values: * package_private * public {#DecisionTableAPI-updateDT_S_O__ul_zbl_yln_lvb} |
| decisionTable.name | String | Optional. Name of the decision table. |
[Table 48. Parameters]

{#DecisionTableAPI-updateDT_S_O__table_pnx_vxg_qvb} {#DecisionTableAPI-updateDT_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-updateDT_S_O__errors-message-entry}{#DecisionTableAPI-updateDT_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "record": GlideRecord, "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-updateDT_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.record | GlideRecord reference to the decision table updated in the Decision Tables \[sys_decision\] table. Data type: GlideRecord |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-updateDT_S_O__ul_lb5_3jm_svb} Data type: String |
[Table 49. Returns]

{#DecisionTableAPI-updateDT_S_O__table_ps1_bgn_lvb}  
This example updates a decision table.

    var decisionID = 'a1f6e14c3d039910f8776a598af9129d';
    var decisionTable = {
       name: 'Emergency Change Request',    
       accessibleFrom: 'public',
    };

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.updateDecisionTable(decisionID, decisionTable);
    gs.info('Status -' + response.status);
    gs.info('Decision Table sys id - ' + response.record.getValue('sys_id'));

Output:

    Status - Success
    Decision Table sys id - a1f6e14c3d039910f8776a598af9129d

## DecisionTableAPI - updateInput(String inputID, Object input) {#ariaid-title27}

Updates a record in the Decision Inputs \[sys_decision_input\] table.
{#DecisionTableAPI-updateInput_S_O__table_zzd_dyg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| inputID | String | Sys_id of the decision input record. Located in the Decision Inputs \[sys_decision_input\] table. |
| input | Object | Key-value pairs to update a decision input record. { active: Boolean, defaultValue: "String", label: "String", mandatory: Boolean, maxsize: Number, order: Number, readonly: Boolean } |
| input.active | Boolean | Optional. Flag that indicates whether the decision input record is active. Valid values: * true: The decision input record is active. * false: The decision input record is not active. {#DecisionTableAPI-updateInput_S_O__ul_xdh_w1d_rvb} |
| input.defaultValue | String | Optional. Default value for the input. |
| input.label | String | Optional. Label of the decision input record. |
| input.mandatory | Boolean | Optional. Flag that indicates whether the input is mandatory. Valid values: * true: The input is mandatory. * false: The input is not mandatory. {#DecisionTableAPI-updateInput_S_O__ul_tpc_jbd_rvb} |
| input.maxsize | Number | Optional. Maximum number of characters allowed in the input field. Use this property only if input.type is `String`. |
| input.order | Number | Optional. Order of the input. |
| input.readonly | Boolean | Optional. Flag that indicates whether the input is read-only. Valid values: * true: The input is read-only. * false: The input is not read-only. {#DecisionTableAPI-updateInput_S_O__ul_q1c_tcd_rvb} |
[Table 50. Parameters]

{#DecisionTableAPI-updateInput_S_O__table_zzd_dyg_qvb} {#DecisionTableAPI-updateInput_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-updateInput_S_O__errors-message-entry}{#DecisionTableAPI-updateInput_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "record": GlideRecord, "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-updateInput_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.record | GlideRecord reference to the decision input updated in the Decision Inputs \[sys_decision_input\] table. Data type: GlideRecord |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-updateInput_S_O__ul_lb5_3jm_svb} Data type: String |
[Table 51. Returns]

{#DecisionTableAPI-updateInput_S_O__table_ps1_bgn_lvb}  
This example updates a decision input.

    var inputID = 'e862f1803dc39910f8776a598af912da';
    var input = {
       label: 'Item name',
       defaultValue: 'Apple',
       maxsize: 100,
    };

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.updateInput(inputID, input);
    gs.info(JSON.stringify(response));
    gs.info('Status - ' + response.status);
    gs.info('Input label changed to - ' + response.record.getValue('label'));

Output:

    Status - Success
    Input label changed to - Item name

## DecisionTableAPI - updateQuestion(String questionID, Object question) {#ariaid-title28}

Updates a record in the Decisions \[sys_decision_question\] table.
{#DecisionTableAPI-updateQuestion_S_O__table_c4l_syg_qvb__entry__3}

| Name | Type | Description |
|-|-|-|
| questionID | String | Sys_id of the question record. Located in the Decisions \[sys_decision_question\] table. |
| question | Object | Key-value pairs to update the question record. { active: Boolean, answer: [Array], condition: "String", defaultAnswer: Boolean, label: "String", order: Number } |
| question.active | Boolean | Optional. Flag that indicates whether the question record is active. Valid values: * true: The question record is active. * false: The question record is not active. {#DecisionTableAPI-updateQuestion_S_O__ul_xdh_w1d_rvb} |
| question.answer | Array | Optional. Array of possible answers to the question. For a single result table, the array can only have one object. For a multi-result table, the array can have multiple objects. [ { name: "String", value: "String" } ] |
| question.answer.name | String | Optional. Name of the answer element. Located in the Result Elements \[sys_decision_multi_result_element\] table. |
| question.answer.value | String | Optional. Value of the answer element. Located in the Result Elements \[sys_decision_multi_result_element\] table. |
| question.condition | String | Optional. Conditions required to reach this question. The fields available for the conditions are the decision inputs that are associated with the decision table. For more information about creating conditions, see [Operators available for filters and queries](https://www.servicenow.com/docs/access?context=r_OpAvailableFiltersQueries&version=xanadu&pubname=xanadu-platform-user-interface&ft:locale=en-US). |
| question.defaultAnswer | Boolean | Optional. Flag that indicates whether this question is the default question for the decision table. Valid values: * true: The question is the default question. * false: The question is not the default question. {#DecisionTableAPI-updateQuestion_S_O__ul_uqg_skz_rvb} |
| question.label | String | Optional. Label of the question record. |
| question.order | Number | Optional. Order of the question. |
[Table 52. Parameters]

{#DecisionTableAPI-updateQuestion_S_O__table_c4l_syg_qvb} {#DecisionTableAPI-updateQuestion_S_O__table_ps1_bgn_lvb__entry__2}{#DecisionTableAPI-updateQuestion_S_O__errors-message-entry}{#DecisionTableAPI-updateQuestion_S_O__errors-type-entry}

| Type | Description |
|-|-|
| Object | Object with information about the status of the API request. { "errors": [Array], "record": GlideRecord, "status": "String" } |
| \<Object\>.errors | Error information. Data type: Array "errors": [ { "message": "String", "type": "String } ] {#DecisionTableAPI-updateQuestion_S_O__errors-codeblock} |
| \<Object\>.errors.message | Error message. Data type: String |
| \<Object\>.errors.type | Type of error. Possible value: INTERNAL_ERROR Data type: String |
| \<Object\>.record | GlideRecord reference to the question updated in the Decisions \[sys_decision_question\] table. Data type: GlideRecord |
| \<Object\>.status | Status of the API request. Possible values: * Success * Failure {#DecisionTableAPI-updateQuestion_S_O__ul_lb5_3jm_svb} Data type: String |
[Table 53. Returns]

{#DecisionTableAPI-updateQuestion_S_O__table_ps1_bgn_lvb}  
This example updates a question record.

    var questionId = '70381fcc3d0b9910f8776a598af91219';
    var questions = {
       condition: 'u_item=Laptop^u_price>1800^EQ',
       answer:[
          {
             name: 'u_discount',
             value: '40',
          },
          {
             name: 'u_seller',
             value: '02826bf03710200044e0bfc8bcbe5d64',
          },
       ],
       active: true,
       order: 3000
    };

    var dt = new sn_dt.DecisionTableAPI();
    var response = dt.updateQuestion(questionId, questions);
    gs.info('Status - ' + response.status);

Output:

    Status - Success


