{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":4046,"path":"build-workflows/workflow-studio/create-data-gathering-action-dynamic-object.md","title":"Create a data gathering action for a dynamic object","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a data gathering action for a dynamic object\n\nCreate an action to collect output values. Then, pass the values to a parent action as a dynamic object.\n\n## Before you begin\n\nRole required: action\\_designer or admin\n\n**Note:** Dynamic outputs are not available in the base system. To use dynamic outputs in Workflow Studio, you must [Request an Integration Hub plugin](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/integrate-applications/request-integrationhub.md).\n\n## About this task\n\nThese steps allow you to create a generic data gathering action for a dynamic output. To see working examples of data gathering actions for dynamic outputs, see [Get started with dynamic outputs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/getting-started-dynamic-output.md).\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Process Automation** &gt; **Workflow Studio**.\n\n2.  On the homepage, select **Actions**.\n\n3.  Select **New** &gt; **New Action**.\n\n4.  In the **Name** field, enter a name for your action, choose the proper **Application** scope, and then select **Submit**.\n\n5.  In the Action Outline, select the add a new step icon \\(\\[Omitted image \"add-new-step-icon.png\"\\] Alt text: Add a new step icon\\) under Inputs and select the **REST** step.\n\n    Configure your REST step to get data from the proper Base URL and Resource Path with any applicable Query Parameters for the HTTP Method `GET`. For more information on using the REST step in Integration Hub, see [REST step](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/rest-request-action-designer.md) and [REST in IntegrationHub](https://developer.servicenow.com/app.do#!/training/article/app_store_learnv2_rest_paris_rest_in_integrationhub/app_store_learnv2_rest_paris_rest_in_integrationhub_objectives?v=paris).\n\n6.  In the Action Outline, select the add a new step icon \\(\\[Omitted image \"add-new-step-icon.png\"\\] Alt text: Add a new step icon\\) under your REST step and select the **Script** step.\n\n    This script step must transform the response from the REST step's Response Body into a format that defines the schema of a dynamic object output for a parent action. Your script step must:\n\n    -   Have a single JSON output variable. The script step can have other output variables, but only one must be of type JSON.\n    -   Format the JSON output variable so that it contains a property named `data`. For a complex object output, your `data` property must have a format similar to the following example:\n\n        ```\n        {\n               data: {\n                   type: \"object\",              \n                   //Required\n        \n                   children: [                  \n                   //Required - This is a collection of field definitions\n        \n                       {\n                           name: \"Name 1\",      \n                           //Required - Unique name\n        \n                           label: \"Label 1\",    \n                           //Required - Display name\n        \n                           type: \"string\"       \n                           //Required - Supported field type (See the Note below)\n        \n                       },\n        \n                       {\n                           name: \"Name 2\",\n                           label: \"Label 2\",\n                           type: \"string\"\n                       }\n                   ]\n               }\n           }\n        \n        ```\n\n        For a complex object array output, your `data` property must have a format similar to the following example:\n\n        ```\n        {\n               data: {\n                   type: \"object\",                          \n                   //Required\n        \n                   attributes: { child_type: \"object\" }     \n                   //Required - Indicates that the array's children are of type object\n        \n                   children: [                              \n                   //Required - This is a collection of field definitions\n        \n                       {\n                           name: \"Name 1\",                  \n                           //Required - Unique name\n        \n                           label: \"Label 1\",                \n                           //Required - Display name\n        \n                           type: \"string\"                   \n                           //Required - Supported field type (See the Note below)\n                       },\n        \n                       {\n                           name: \"Name 2\",\n                           label: \"Label 2\",\n                           type: \"string\"\n                       }\n                   ]\n               }\n           }\n        ```\n\n        **Note:** Supported [action data types](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/action-inputs-outputs.md) for the `type` property include:\n\n        -   `string`\n        -   `integer`\n        -   `datetime`\n        -   `choice`\n        -   `boolean`\n        -   `object`\n        -   `array.string`\n        -   `array.integer`\n        -   `array.datetime`\n        -   `array.choice`\n        -   `array.boolean`\n        -   `array.object`\n7.  In the Action Outline, select **Outputs**.\n\n    1.  Create an output of type **Dynamic Output**.\n\n        **Note:** If you don't see Dynamic Outputs as a data type option, then you're missing an Integration Hub subscription.\n\n    2.  In the Dynamic Options, select a data gathering action for the **Action** option.\n\n        For examples of dynamic output data gathering actions, see [Get started with dynamic outputs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/getting-started-dynamic-output.md).\n\n    3.  If needed set the **Depends On Another input** option, and select the input.\n\n    Create an outputs of type Dynamic Object.\n\n8.  Select **Save** and [test the action](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/test-action.md).\n\n    In the execution details, your data gathering action runs successfully if the runtime value for `output` contains the `data` property in the proper format.\n\n9.  Select **Publish** to make the action available to other flows or actions within the same application scope.\n\n    \\[Omitted image \"create-data-gathering-action-dynamic-object-result.png\"\\] Alt text: Use your data gathering action to populate schema values for a dynamic object.\n\n    You can now use your data gathering action to populate the schema values for a dynamic object in a parent action.\n\n\n**Parent Topic:**[Dynamic outputs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/build-workflows/workflow-studio/dynamic-outputs.md)\n\n**Related topics**  \n\n\n[Get started with dynamic outputs]()\n\n[Dynamic output configuration options]()\n\n"}}