---
sourceDocument: Australia Build workflows
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/build-workflows

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia Build workflows

ft:clusterId :

    - crworkflow

bundleId :

    - crworkflow

workflow :

    - Creator


---

# Get started with dynamic outputs

# Get started with dynamic outputs {#ariaid-title1}

* Release version: Australia
* 
* Updated March 12, 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 13 minutes to read

Create a sample action that builds dynamic outputs for use in a flow.

## Before you begin

Role required: action_designer or admin

## Procedure

1. [Create connection and credential records for dynamic outputs](https://servicenow-prod.fluidtopics.net/WfVizoi4nSw5gQ_RszaHQA#create-connection-and-credential-records "Create the aliases, connections, and credentials that REST steps will use to connect to your local instance.")  
   This connection \& credential alias will provide the base URL and user account needed to configure the REST steps of your data gathering actions.
2. [Create a data gathering action to get a record schema](https://servicenow-prod.fluidtopics.net/WfVizoi4nSw5gQ_RszaHQA#create-data-gathering-action-to-get-record-schema "Create a data gathering action to look up a table schema and convert into a JSON object.")  
   This data gathering action will convert a single record into a JSON object for a record dynamic output.
3. [Create a data gathering action to get an array of records schema](https://servicenow-prod.fluidtopics.net/WfVizoi4nSw5gQ_RszaHQA#create-data-gathering-action-to-get-array-of-records-schema "Create a data gathering action to generate an array of objects from a list of records.")  
   This data gathering action will convert a list of records record into JSON array of objects for a records dynamic output.
4. [Create a custom action to test dynamic outputs](https://servicenow-prod.fluidtopics.net/WfVizoi4nSw5gQ_RszaHQA#get-started-dynamic-output-create-dynamic-record-action "Create a sample action to dynamically generate two action outputs, Record and Records which refresh dynamically when the value for the Table input changes.")  
   This custom action illustrates two types of dynamic output data. One dynamic output generates an object for a single record. Another dynamic output generates an array of objects for a list of records.
{#getting-started-dynamic-output__steps_bfz_nlf_mjb}
**Related tasks**   

* [Create a data gathering action for a dynamic object](https://servicenow-prod.fluidtopics.net/cmIIAfouoZHM_0iP9q417w "Create an action to collect output values. Then, pass the values to a parent action as a dynamic object.")  
**Related reference**   

* [Dynamic output configuration options](https://servicenow-prod.fluidtopics.net/BM5b26NvDJB6k0UAn1HMLQ "Use these options to configure your dynamic outputs for a parent action.")

## Create connection and credential records for dynamic outputs {#ariaid-title2}

Create the aliases, connections, and credentials that REST steps will use to connect to your local instance.

### Before you begin

Role required: admin

### Procedure

1. Navigate to AllConnections \& CredentialsCredentials.
2. Select New, select Basic Auth Credentials, and enter these field values.
   1. For Name, enter <kbd class="ph userinput">Local Admin</kbd>.
   2. For User name, enter a user account with access to Flow Designer and the REST API.  
      For example, enter <kbd class="ph userinput">admin</kbd>.
   3. For Password, enter the account password.
   {#create-connection-and-credential-records__substeps_wmq_nxk_kxb}
3. Select Submit to create the credential record.
4. Navigate to AllConnections \& CredentialsConnection \& Credential Aliases.
5. Select New and enter these fields values.
   1. For Name, enter Local Instance.
   2. Accept the default value of HTTP for the Connection type.
   3. Select Submit to create the Connection \& Credential Alias record.
   {#create-connection-and-credential-records__substeps_wm4_dzk_kxb}
6. Select the alias you created.  
   For example, select Local Instance.
7. From the Connections related list, select New, and enter these field values.
   1. For Name, enter <kbd class="ph userinput">My Instance</kbd>.
   2. For Credential, select the basic authentication credential record you created.  
      For example, select the Local Admin credential.
   3. For Connection URL, enter the base URL for your instance including the forward slash at the end.  
      Include the URL prefix https:// and add a slash character at the end of the URL.  
      For example, <kbd class="ph userinput">https://example.service-now.com/</kbd>.
   4. Select Submit to create the HTTP(s) Connection record.
   {#create-connection-and-credential-records__substeps_d5c_c1l_kxb}
{#create-connection-and-credential-records__steps_jth_nf3_ccc}

## Create a data gathering action to get a record schema {#ariaid-title3}

Create a data gathering action to look up a table schema and convert into a JSON object.

### Before you begin

Role required: action_designer or admin

### About this task

In this task, you create a data gathering action that collects the schema for a record on your instance. The goal is to create a complex object for use as a dynamic output. This data gathering action consists of the following:

* A REST step to gather table schema data for a selected table. The REST step Response Body is in JSON format.
* A script step to transform the REST step's JSON Response Body into a dynamic object. The dynamic object consists of JSON name-value pairs, where there is an entry for each field in the table.
* An output variable named `output` of type JSON to store the dynamic object.

{#create-data-gathering-action-to-get-record-schema__ul_srw_bnf_mjb}  
Note:  
This task re-creates the demo actions that are installed when you [Request an Integration Hub plugin](https://www.servicenow.com/docs/access?context=request-integrationhub&version=australia&pubname=australia-integrate-applications&ft:locale=en-US) for your instance.

### Procedure

1. Navigate to AllProcess AutomationWorkflow Studio.
2. On the homepage, select Actions.
3. Select New and select New Action.
   1. On the Action Properties screen, in the Name field, enter <kbd class="ph userinput">Get ServiceNow Object Schema (Dynamic)</kbd>.
   2. Select Submit.
   {#create-data-gathering-action-to-get-record-schema__substeps_ekt_fcm_mjb}
4. In the Action Outline, select Inputs.
   1. In the Action Input header, select Create Input.
   2. In the Label and Name fields, enter <kbd class="ph userinput">Table</kbd>.
   3. In the Type field, select <kbd class="ph userinput">String</kbd>.
   4. To make this input required, toggle the Mandatory slider so that it is active.
   {#create-data-gathering-action-to-get-record-schema__substeps_byd_r3m_mjb}
5. In the Action Outline, select the add a new step icon (![Add a new step icon]()) under Inputs and select REST Step.
6. Under the REST step header, fill in the following fields.  
   {#create-data-gathering-action-to-get-record-schema__table_pvd_ftf_mjb__entry__2}

   | Field | Value |
   |-|-|
   | Connection | Leave the Use Connection Alias option selected. |
   | Connection Alias | select the create new record icon (![Create new record icon]()) to create a new [Create an HTTP(s) connection](https://www.servicenow.com/docs/access?context=create-https-connection&version=australia&pubname=australia-platform-security&ft:locale=en-US), or use an existing connection for your instance. The Credential for the HTTP(s) connection must use [Basic authentication credentials](https://www.servicenow.com/docs/access?context=r_BasicAuthCredentialsForm&version=australia&pubname=australia-platform-security&ft:locale=en-US). Additionally, the Connection URL must be the base URL for your instance, including the forward slash at the end. For more information on connections and credentials, see [Getting started with connections](https://www.servicenow.com/docs/access?context=connection-information&version=australia&pubname=australia-platform-security&ft:locale=en-US) and [Getting started with credentials](https://www.servicenow.com/docs/access?context=credentials-getting-started&version=australia&pubname=australia-platform-security&ft:locale=en-US). |
   | Build Request | Leave the Manually option selected. |
   | Resource Path | Enter <kbd class="ph userinput">api/now/processflow/table/</kbd> and then select the data pill picker (![Data pill picker]()). Select InputsTable. Next, enter <kbd class="ph userinput">/schema</kbd>. |
   | HTTP Method | Enter <kbd class="ph userinput">GET</kbd> |
   | Query Parameters | select the plus icon (![Plus icon]() to add a new query parameter. Then, in the Name field, enter <kbd class="ph userinput">get_choices</kbd> and <kbd class="ph userinput">true</kbd> in the Value field. |
   [ ]

   {#create-data-gathering-action-to-get-record-schema__table_pvd_ftf_mjb}
7. In the Action Outline, select the add a new step icon (![Add a new step icon]()) under your REST step and select the Script step.
   1. In the Input Variables section, select Create Variable.
   2. In the Name field, enter <kbd class="ph userinput">payload</kbd>.
   3. Next to the Value field, select the data pill picker (![Data pill picker]()) and select REST StepResponse Body.
   4. In the Script field, enter the following code.  


          (function execute(inputs, outputs) {
            var payload = JSON.parse(inputs.payload);
            
            var columns = payload.result.data.columns;
            var schema = columns.map(function(column) {
              var value = {
                label: column.label,
                name: column.name,
                type: getCOType(column.definition.base_type),
              };
              if (column.definition.type === 'choice') {
                value.type = 'choice';
                value.choices = column.definition.choices;
              } 
              if (column.definition.base_type === 'GUID') {
                value.children = [
                  { label: 'Link', name: 'link', type: 'string' },
                  { label: 'Value', name: 'value', type: 'string' },
                ];
              }
              return value;
            });
            outputs.schema = { 
              data: {
                type: 'object',
                children: schema,
              },
            };
            
            function getCOType(type) {
              if (type === 'GUID') return 'reference';
              return type;
            }
          })(inputs, outputs);

   5. In the Output Variables section, select Create Variable.
   6. In the Label and Name fields, enter <kbd class="ph userinput">schema</kbd>.
   7. In the Type field, select <kbd class="ph userinput">JSON</kbd>.
   {#create-data-gathering-action-to-get-record-schema__substeps_ytx_lwf_mjb}
8. In the Action Outline, select Outputs.
   1. In the Action Output header, select Create Output.
   2. In the Label and Name fields, enter <kbd class="ph userinput">output</kbd>.
   3. In the Type field, select <kbd class="ph userinput">JSON</kbd>.
   4. In the Action Output header, select Exit Edit Mode.
   5. Next to the Value field, select the data pill picker (![Data pill picker]()) and select Script Stepschema.
   {#create-data-gathering-action-to-get-record-schema__substeps_fkt_fcm_mjb}
9. In the Action header, select Save and then select Test to [test the action](https://servicenow-prod.fluidtopics.net/RkJbg1UGUC3YJAc2dyKZOQ "Test an action before publishing it for other users.").
   1. On the Test Action screen, enter <kbd class="ph userinput">incident</kbd> for the Table input.
   2. Select Run Test.
   3. Check the action's execution details.

   {#create-data-gathering-action-to-get-record-schema__substeps_tcd_gvm_mjb}  
   Your data gathering action runs successfully if the runtime value for `fields` is a complex object in a format that is similar to the following abbreviated example.

       {
              "data": {
                  "type": "object",
                  "children": [
                      {
                          "name": "active",
                          "label": "Active",
                          "type": "boolean"
                      },
                      {
                          "name": "activity_due",
                          "label": "Activity due",
                          "type": "datetime"
                      }, ...

10. In the Action header, select Publish to make the Get ServiceNow Object Schema (Dynamic) action available to other flows and actions within the Global scope.
{#create-data-gathering-action-to-get-record-schema__steps_bfz_nlf_mjb}

## Create a data gathering action to get an array of records schema {#ariaid-title4}

Create a data gathering action to generate an array of objects from a list of records.

### Before you begin

Role required: action_designer or admin

### About this task

In this task, you create a data gathering action that collects the schema for a record on your instance. The goal is to create a complex object for use as a dynamic output. This data gathering action consists of the following:

* A REST step to gather table schema data for a selected table. The REST step Response Body is in JSON format.
* A script step to transform the REST step's JSON Response Body into a dynamic object. The dynamic object consists of a JSON array of objects, where each source record is converted into one object of the array.
* An output variable named `output` of type JSON to store the dynamic object.

{#create-data-gathering-action-to-get-array-of-records-schema__ul_srw_bnf_mjb}  
Note:  
This task re-creates the demo actions that are installed when you [Request an Integration Hub plugin](https://www.servicenow.com/docs/access?context=request-integrationhub&version=australia&pubname=australia-integrate-applications&ft:locale=en-US) for your instance.

### Procedure

1. Navigate to AllProcess AutomationWorkflow Studio.
2. On the homepage, select Actions.
3. Select New and select New Action.
   1. On the Action Properties screen, in the Name field, enter <kbd class="ph userinput">Get ServiceNow Array.Object Schema (Dynamic)</kbd>.
   2. Select Submit.
   {#create-data-gathering-action-to-get-array-of-records-schema__substeps_ekt_fcm_mjb}
4. In the Action Outline, select Inputs.
   1. In the Action Input header, select Create Input.
   2. In the Label and Name fields, enter <kbd class="ph userinput">Table</kbd>.
   3. In the Type field, select <kbd class="ph userinput">String</kbd>.
   4. To make the input required, toggle the Mandatory slider so that it is active.
   {#create-data-gathering-action-to-get-array-of-records-schema__substeps_gl2_dyf_mjb}
5. In the Action Outline, select the add a new step icon (![New step icon]()) under Inputs and select the REST step.
6. Under the REST step header, fill in the following fields.  
   {#create-data-gathering-action-to-get-array-of-records-schema__table_pjn_hxm_mjb__entry__2}

   | Field | Value |
   |-|-|
   | Connection | Leave Use Connection Alias selected. |
   | Connection Alias | select the create new record icon (![Create new record icon]()) to create a new [Create an HTTP(s) connection](https://www.servicenow.com/docs/access?context=create-https-connection&version=australia&pubname=australia-platform-security&ft:locale=en-US), or use an existing connection for your instance. The Credential for the HTTP(s) connection must use [Basic authentication credentials](https://www.servicenow.com/docs/access?context=r_BasicAuthCredentialsForm&version=australia&pubname=australia-platform-security&ft:locale=en-US). Additionally, the Connection URL must be the base URL for your instance, including the forward slash at the end. |
   | Build Request | Leave Manually selected. |
   | Resource Path | Enter <kbd class="ph userinput">api/now/processflow/table/</kbd> and then select the data pill picker (![Data pill picker]()). Select InputsTable. Finally, enter <kbd class="ph userinput">/schema</kbd> |
   | HTTP Method | Enter <kbd class="ph userinput">GET</kbd> |
   | Query Parameters | select the plus icon (![Plus icon]() to add a new query parameter. Then, in the Name field, enter <kbd class="ph userinput">get_choices</kbd> and <kbd class="ph userinput">true</kbd>in the Value field. |
   [ ]

   {#create-data-gathering-action-to-get-array-of-records-schema__table_pjn_hxm_mjb}
7. In the Action Outline, select the Add a new step(![New step icon]()) icon under your REST step and select the Script step.
   1. In the Input Variables section, select Create Variable.
   2. In the Name field, enter <kbd class="ph userinput">payload</kbd>.
   3. Next to the Value field, select the data pill picker (![Data pill picker]()) and select REST StepResponse Body.
   4. In the Script field, enter the following code.  


          (function execute(inputs, outputs) {
            var payload = JSON.parse(inputs.payload);
            
            var columns = payload.result.data.columns;
            var schema = columns.map(function(column) {
              var value = {
                label: column.label,
                name: column.name,
                type: getCOType(column.definition.base_type),
              };
              if (column.definition.type === 'choice') {
                value.type = 'choice';
                value.choices = column.definition.choices;
              }
              return value;
            });
            outputs.schema = { 
              data: {
                type: 'array.object',
                attributes: {
                  child_type: 'object',
                },
                children: schema,
              },
            };
            
            function getCOType(type) {
              if (type === 'GUID') return 'string';
              return type;
            }
          })(inputs, outputs);

   5. In the Output Variables section, select Create Variable.
   6. In the Label and Name fields, enter <kbd class="ph userinput">schema</kbd>.
   7. In the Type field, select <kbd class="ph userinput">JSON</kbd>.
   {#create-data-gathering-action-to-get-array-of-records-schema__substeps_uhc_fzf_mjb}
8. In the Action Outline, select Outputs.
   1. On the Action Output header, select Create Output.
   2. Enter <kbd class="ph userinput">output</kbd> in the Label field and Name field.
   3. Select <kbd class="ph userinput">JSON</kbd> for the Type field.
   4. Select Exit Edit Mode.
   5. Next to the Value field, select the data pill picker (![Data pill picker]()) and select Script Stepschema.
   {#create-data-gathering-action-to-get-array-of-records-schema__substeps_ymc_lzf_mjb}
9. In the Action header, select Save and then select Test to [test the action](https://servicenow-prod.fluidtopics.net/RkJbg1UGUC3YJAc2dyKZOQ "Test an action before publishing it for other users.").
   1. On the Test Action screen, in the Table field, enter <kbd class="ph userinput">incident</kbd>.
   2. Select Run Test.
   3. Check the action's execution details.  
      Your data gathering action runs successfully if the runtime value for `fields` output is a complex object that contains an array of key-value pairs for `label`, `name`, and `value` as shown in the following abbreviated example.

          {
                 "data": {
                     "type": "array.object",
                     "children": [
                         {
                             "name": "active",
                             "label": "Active",
                             "type": "boolean"
                         },
                         {
                             "name": "activity_due",
                             "label": "Activity due",
                             "type": "datetime"
                         }, ...

   {#create-data-gathering-action-to-get-array-of-records-schema__substeps_ikt_fcm_mjb}
10. In the Action header, select Publish to make the Get ServiceNow Array.Object Schema (Dynamic) action available to other actions within the Global scope.
{#create-data-gathering-action-to-get-array-of-records-schema__steps_brx_wfp_ccc}

## Create a custom action to test dynamic outputs {#ariaid-title5}

Create a sample action to dynamically generate two action outputs,
`Record` and `Records` which refresh dynamically when the
value for the Table input changes.

### Before you begin

Role required: action_designer or admin

### About this task

This custom action uses two data gathering actions to populate dynamic outputs.

### Procedure

1. In the main header, select the create flow, subflow, or action icon (![Create flow, subflow, or action icon]()) and select Action.
   1. In the Action Properties modal, in the Name field, enter <kbd class="ph userinput">Get ServiceNow Records (Dynamic)</kbd>.
   2. Select Submit.
   {#get-started-dynamic-output-create-dynamic-record-action__substeps_k3k_hbg_mjb}
2. In the Action Outline, select Inputs.
   1. In the Action Input header, select Create Input.
   2. In the Label and Name fields, enter <kbd class="ph userinput">Table</kbd>.
   3. In the Type field, select <kbd class="ph userinput">Dynamic Choice</kbd>.
   4. To make the input required, toggle the Mandatory slider so that it is active.
   5. Select the Toggle advanced inputs icon (![Toggle advanced inputs icon]() to display the advanced options for the `Table` input.
   6. In the Default value field, enter <kbd class="ph userinput">incident</kbd>.
   7. Under Dynamic Options, in the Action field, select Get ServiceNow Tables - Dynamic.
   8. Select Create Input to create another action input.
   9. In the Label and Name fields, enter <kbd class="ph userinput">NumberOfRecords</kbd>.
   10. In the Type field, select Integer.
   11. To make the input required, toggle the Mandatory slider so that it is active.
   12. Select the Toggle advanced inputs icon (![Toggle advanced inputs icon]() to display the advanced options for the `Table` input.
   13. In the Default value field, enter <kbd class="ph userinput">3</kbd>.
   {#get-started-dynamic-output-create-dynamic-record-action__substeps_mdf_mbg_mjb}
3. In the Action Outline, select the add a new step icon (![New step icon]()) under Inputs and select the REST step.
4. Under the REST step header, fill in the following fields.  
   {#get-started-dynamic-output-create-dynamic-record-action__table_gym_n5f_mjb__entry__2}

   | Field | Value |
   |-|-|
   | Connection | Leave Use Connection Alias selected. |
   | Connection Alias | Select the create new record icon (![Create new record icon]()) to create a new [Create an HTTP(s) connection](https://www.servicenow.com/docs/access?context=create-https-connection&version=australia&pubname=australia-platform-security&ft:locale=en-US), or use an existing connection for your instance. The Credential for the HTTP(s) connection must use [Basic authentication credentials](https://www.servicenow.com/docs/access?context=r_BasicAuthCredentialsForm&version=australia&pubname=australia-platform-security&ft:locale=en-US). Additionally, the Connection URL must be the base URL for your instance, including the forward slash at the end. |
   | Build Request | Leave Manually selected |
   | Resource Path | Enter <kbd class="ph userinput">api/now/table/</kbd> and then select the data pill picker (![Data pill picker]()). Select InputsTable. |
   | HTTP Method | Enter <kbd class="ph userinput">GET</kbd> |
   | Query Parameters | Select the plus icon (![Plus icon]() to add a new query parameter. Then, enter <kbd class="ph userinput">sysparm_limit</kbd> in the Name field. Next to the Value field, select the data pill picker (![Data pill picker]()) and then select InputsNumberOfRecords. |
   [ ]

   {#get-started-dynamic-output-create-dynamic-record-action__table_gym_n5f_mjb}
5. In the Action Outline, select the add a new step icon (![New step icon]()) under Inputs and select the Script step.
   1. In the Input Variables section, select Create Variable.
   2. In the Name field, enter <kbd class="ph userinput">payload</kbd>.
   3. Next to the Value field, select the data pill picker (![Data pill picker]()) and select REST StepResponse Body.
   4. In the Script field, enter the following code.  


          (function execute(inputs, outputs) {
            var response = JSON.parse(inputs.payload);
            var records = response.result;
            outputs.record = records[0];
            outputs.records = JSON.stringify(records);
          })(inputs, outputs);

   5. In the Output Variables section, select Create Variable.
   6. In the Label and Name fields, enter <kbd class="ph userinput">record</kbd>.
   7. Select JSON for the Type field.
   8. Toggle the Mandatory slider so that it is active.
   9. Select Create Variable to create another output variable for the script step.
   10. In the Label and Name fields, enter <kbd class="ph userinput">records</kbd>.
   11. In the Type field, select <kbd class="ph userinput">JSON</kbd>.
   12. To make the input required, toggle the Mandatory slider so that it is active.
   {#get-started-dynamic-output-create-dynamic-record-action__substeps_ghf_5bg_mjb}
6. In the Action Outline, select Outputs.
   1. In the Action Output header, select Create Output.
   2. In the Label and Name fields, enter <kbd class="ph userinput">Records</kbd>.
   3. In the Type field, select Dynamic Object.
   4. Select the Toggle advanced inputs icon (![Toggle advanced inputs icon]() to display the advanced options for the `Records` output.
   5. Under Dynamic Options, select Get ServiceNow Array.Object Schema (Dynamic) as the Action.
   6. To make the Table input dependent on another input, toggle the Depends-On Another Input slider to make it active.
   7. In the Tablee field, select Table.
   8. In the Action Output header, select Exit Edit Mode.
   9. Next to the Value field, select the data pill picker (![Data pill picker]()) and select Script Steprecords.
   10. In the Action Output header, select Edit OutputsCreate Output to create another action output.
   11. In the Label and Name fields, enter <kbd class="ph userinput">Record</kbd>.
   12. In the Type field, select <kbd class="ph userinput">Dynamic Object</kbd>.
   13. Select the Toggle advanced inputs icon (![Toggle advanced inputs icon]() to display the advanced options for the `Record` output.
   14. Under Dynamic Options, in the Action field, select Get ServiceNow Object Schema (Dynamic).
   15. To make the Table input dependent on another input, toggle the Depends-On Another Input slider to make it active.
   16. In the Table field, select Table.
   17. In the Action Output header, select Exit Edit Mode.
   18. For the Value, select the data pill picker (![Data pill picker]()) and select Script Steprecord.
   {#get-started-dynamic-output-create-dynamic-record-action__substeps_jfx_fbn_mjb}
7. In the Action header, select Save and then select Test to [test the action](https://servicenow-prod.fluidtopics.net/RkJbg1UGUC3YJAc2dyKZOQ "Test an action before publishing it for other users.").
   1. On the Test Action screen, select any dynamically generated choice value for the Table input.
   2. Select Run Test.
   3. Check the action's execution details.  
      Your action runs successfully if the runtime value for `Record` is a properly formatted complex object and the runtime value for `Records` is a properly formatted complex object array.
   {#get-started-dynamic-output-create-dynamic-record-action__substeps_qn3_qcg_mjb}
8. In the Action header, select Publish to make the Get ServiceNow Records (Dynamic) action available to flows within the Global scope.

### Result

You can now add the Get ServiceNow Records (Dynamic) action to a flow. This sample action dynamically generates two action outputs, `Record` and `Records`, which can be accessed
as data pills in the data panel. The data pills refresh dynamically when the value for the Table input changes.

*[\>]: and then


