<h2>Data Stream actions and pagination</h2><br/><div style="overflow-x:auto"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta content="text/html; charset=UTF-8" /><meta name="copyright" content="(C) Copyright 2025" /><meta name="DC.rights.owner" content="(C) Copyright 2025" /><meta name="generator" content="DITA-OT" /><meta name="DC.type" content="concept" /><meta name="DC.title" content="Data Stream actions and pagination" /><meta name="abstract" content="Send REST, SOAP, or JDBC requests from Flow Designer to APIs that return a stream of response data larger than 10 MB, or that return paginated results. Parse stream data into a series of complex object outputs and use the data pills in other actions in a flow." /><meta name="description" content="Send REST, SOAP, or JDBC requests from Flow Designer to APIs that return a stream of response data larger than 10 MB, or that return paginated results. Parse stream data into a series of complex object outputs and use the data pills in other actions in a flow." /><meta name="DC.relation" scheme="URI" content="../../../administer/integrationhub/concept/integrationhub.html" /><meta name="DC.relation" scheme="URI" content="../../../build/create-integrations-apps/concept/create-integrations-applications.html" /><meta name="DC.relation" scheme="URI" content="../../../administer/integrationhub/concept/data-stream-design.html" /><meta name="DC.relation" scheme="URI" content="../../../administer/integrationhub/concept/dsa-on-mid.html" /><meta name="DC.relation" scheme="URI" content="../../../administer/integrationhub/tasks/create-data-stream-action.html" /><meta name="DC.relation" scheme="URI" content="../../../administer/integrationhub/tasks/test-data-stream-action.html" /><meta name="DC.relation" scheme="URI" content="../../../administer/integrationhub/tasks/use-data-stream-in-flow.html" /><meta name="DC.creator" content="ServiceNow" /><meta name="DC.date.created" content="2023-08-03" /><meta name="DC.date.modified" content="2023-08-03" /><meta name="mini-toc" content="yes" /><meta name="page-type" content="automation-engine" /><meta name="DC.format" content="XHTML" /><meta name="DC.identifier" content="data-stream-actions" /><link rel="stylesheet" type="text/css" href="../../../CSS/commonltr.css" /><title>Data Stream actions and pagination</title></head><body id="data-stream-actions"> <div class="breadcrumb"><a class="link" href="../../../build/create-integrations-apps/concept/create-integrations-applications.html" title="Increase the impact of your cross‑enterprise workflows by connecting any application or data. Connect people, processes, and apps to enhance the value of your ServiceNow investment.">Creating integrations with applications</a> > </div> <h1 class="title topictitle1" id="ariaid-title1">Data Stream actions and pagination</h1> <div class="body conbody"><p class="shortdesc"><span class="ph">Send REST, SOAP, or JDBC requests from <span class="ph">Flow Designer</span> to APIs that return a stream of response data larger than 10 MB, or that return paginated results. Parse stream data into a series of complex object outputs and use the data pills in other actions in a flow.</span></p> <div class="p">For example, create a <span class="ph">Data Stream</span> action to import a large quantity of employee data from a third-party HR site. The <span class="ph">Data Stream</span> action sends a REST request to the third-party site and processes the response to populate records in the User [sys_user] table.<div class="note"><span class="notetitle">Note:</span> <span class="ph">Data Stream actions require an <span class="ph">Integration Hub</span> subscription. For more information, see <a class="xref" href="https://www.servicenow.com/content/dam/servicenow-assets/public/en-us/doc-type/legal/snc-addendum-integrationhub.pdf" target="_blank" rel="noopener noreferrer">Legal schedules - Integration Hub overview</a>.</span></div> </div> <div class="section" id="data-stream-actions__section_d3h_2pm_tgb"><h2 class="title sectiontitle">Benefits</h2> <p class="p"><span class="ph">Data Stream</span> actions offer these benefits.</p> <div class="p"><ul class="ul" id="data-stream-actions__ul_k2p_2pm_tgb"><li class="li">Parse and format a stream of response data larger than 10 MB.</li><li class="li">Automatically send multiple requests to APIs that paginate results, if applicable.</li><li class="li">Can be used in <a class="xref" href="integrationhub-imports.html" title="Automate data import tasks through a consolidated interface that provides a guided, step-by-step experience. Define external data sources, specify target tables, map how source data becomes target data, and schedule regular imports.">Integration Hub - Import</a> and to <a class="xref" href="../../import-sets/task/create-data-stream-data-source.html" title="Create a Data Stream (IntegrationHub) type data source record to define what complex data an import set should import from a Data Stream action.">create a data source</a>.</li><li class="li">Enable flow designers to process large requests without complex coding or configuration.</li><li class="li">Enable flow designers to <span class="ph">process each object within a data stream using <span class="ph uicontrol">For each</span> flow logic. For example, you might create a <span class="ph">Data Stream</span> action that imports document data from a third-party site. When you add the action to a flow, <span class="ph">Flow Designer</span> automatically adds the action to a <span class="ph uicontrol">For each</span> flow logic block, enabling flow designers to easily create a record in <span class="ph">ServiceNow</span> for each object in the data stream. See <a class="xref" href="../tasks/use-data-stream-in-flow.html" title="Data Stream actions use the For each flow logic option to process stream data in a flow. For example, suppose that you want to use a Data Stream action that imports document data from a third-party site. When added to a flow, the action appears as a For each flow logic block, enabling flow designers to easily create a record in ServiceNow for each object in the data stream.">Use a Data Stream action in a flow</a>.</span></li><li class="li">Enable flow designers to reuse <span class="ph">Data Stream</span> actions in multiple flows, using the same source of data in multiple ways.</li></ul> </div> </div> <div class="section" id="data-stream-actions__section_dq2_x13_z3b"><h2 class="title sectiontitle">Running a Data Stream action</h2> <p class="p">There are two ways to run a <span class="ph">Data Stream</span> action.</p> <div class="p"><dl class="dl"> <dt class="dt dlterm">From a flow</dt> <dd class="dd">You can <span class="ph">process each object within a data stream using <span class="ph uicontrol">For each</span> flow logic. For example, you might create a <span class="ph">Data Stream</span> action that imports document data from a third-party site. When you add the action to a flow, <span class="ph">Flow Designer</span> automatically adds the action to a <span class="ph uicontrol">For each</span> flow logic block, enabling flow designers to easily create a record in <span class="ph">ServiceNow</span> for each object in the data stream. See <a class="xref" href="../tasks/use-data-stream-in-flow.html" title="Data Stream actions use the For each flow logic option to process stream data in a flow. For example, suppose that you want to use a Data Stream action that imports document data from a third-party site. When added to a flow, the action appears as a For each flow logic block, enabling flow designers to easily create a record in ServiceNow for each object in the data stream.">Use a Data Stream action in a flow</a>.</span></dd> <dt class="dt dlterm">From a script</dt> <dd class="dd">You can start a <span class="ph">Data Stream</span> using the executeDataStreamAction() method in the FlowAPI class. For more information, see <a class="xref" href="../app-store/dev_portal/API_reference/ScriptableFlowAPI/concept/ScriptableFlowAPI.dita/ScriptableFlowAPI.html" target="_blank" rel="noopener noreferrer">FlowAPI</a>.</dd> </dl> </div> </div> <div class="section" id="data-stream-actions__section_wnp_sgg_5gb"><h2 class="title sectiontitle">Action outline</h2> <p class="p"><span class="ph">Data Stream</span> actions follow a set structure. Follow prompts to add and remove steps from the action outline. You cannot manually add steps to a <span class="ph">Data Stream</span> action.</p> <div class="fig fignone" id="data-stream-actions__fig_nps_smk_h4b"><span class="figcap"><span class="fig--title-label">Figure 1. </span>REST and SOAP Data Stream actions</span> <img class="image" id="data-stream-actions__image_ops_smk_h4b" src="../images/datastreamactions.gif" alt="REST and SOAP Data Stream action." /> </div> <div class="fig fignone" id="data-stream-actions__fig_isn_vmk_h4b"><span class="figcap"><span class="fig--title-label">Figure 2. </span>JDBC Data Stream action</span> <img class="image" id="data-stream-actions__image_jsn_vmk_h4b" src="../images/jdbc-data-stream.gif" alt="JDBC Data Stream action" /> </div> <div class="p"><div class="note"><span class="notetitle">Note:</span> <span class="ph">Clearing an option in a configuration page removes the step from the <span class="ph">Data Stream</span> outline and deletes all data associated with the step.</span></div> </div> </div> <div class="section" id="data-stream-actions__section_c3c_l1t_tgb"><h2 class="title sectiontitle">Action Preprocessing</h2> <p class="p">Use the Action Preprocessing category to retrieve connection and credential details or to run a preprocessing script.</p> <p class="p">Select <span class="ph uicontrol">Retrieve connection info</span> to retrieve connection and credential details to use in your action. Selecting this option adds the Get Connection Info step as the first step in the action preprocessing. For more information, see <a class="xref" href="../administer/flow-designer/reference/get-connection-info-action-designer.dita/get-connection-info-action-designer.html" target="_blank" rel="noopener noreferrer">Get Connection Info step</a>.</p> <p class="p">Select <span class="ph uicontrol">Enable preprocessing script</span> to run a preprocessing script before the action sends the initial API request. For example, validate action inputs or set default values. <span class="ph">Selecting this option adds a script step to the <span class="ph">Data Stream</span> action. For more information, see <a class="xref" href="../administer/flow-designer/reference/javascript-step-action-designer.dita/javascript-step-action-designer.html" target="_blank" rel="noopener noreferrer">Script step</a>.</span></p> <p class="p">Preprocessing executes once per action, before the first API request.</p> <p class="p">This is an optional <span class="ph">Data Stream</span> action component that runs on either the instance or a <span class="ph">MID Server</span>.</p> </div> <div class="section" id="data-stream-actions__section_a32_m1t_tgb"><h2 class="title sectiontitle">Request</h2> <p class="p">Use the Request category to configure how the action sends API requests. The Request section executes once per page of results. Request components provide these configuration options.</p> <div class="p"><dl class="dl"> <dt class="dt dlterm">Pagination Setup step</dt> <dd class="dd"><p class="p">Request <span class="ph">results in batches. Once one page of data is processed, the <span class="ph">Data Stream</span> action runs the request section again to return the next set of results.</span> Use the pagination setup step to set up pagination options required by the API. Configure the Pagination Setup step manually, or select a pre-built template to apply common configurations. <span class="ph">For example, apply the <span class="ph uicontrol">Limit / Offset</span> template to specify the number of items you want returned per page (limit), and the starting number for the first item (offset). After applying a template, update the values to ensure that the configuration complies with the API's requirements.</span></p> <div class="p"><div class="note"><span class="notetitle">Note:</span> For licensing purposes, each request counts as one transaction, including each request for the next page of results.</div> </div> <p class="p">The value of the reserved, read-only <code class="ph codeph">getNextPage</code> variable determines whether to request another page of results. <span class="ph">As long as the <code class="ph codeph">getNextPage</code> variable is true and the previous page contains data, the action continues to send requests for the next page.</span></p> <div class="p"><div class="note"><span class="notetitle">Note:</span> You must explicitly set the value to true in the script or it will default to false.</div> </div> <div class="p">This is an optional Request component that only runs on the instance.<div class="note"><span class="notetitle">Note:</span> Pagination isn't applicable to the JDBC step.</div> </div> </dd> <dt class="dt dlterm">Script step</dt> <dd class="dd"><p class="p">Run a script before every request for the next page of results. Use this script for data validation and transformation when calling a paginated API. For example, generate a JSON payload for the next page request. <span class="ph">Selecting this option adds a script step to the <span class="ph">Data Stream</span> action. For more information, see <a class="xref" href="../administer/flow-designer/reference/javascript-step-action-designer.dita/javascript-step-action-designer.html" target="_blank" rel="noopener noreferrer">Script step</a>.</span></p> <p class="p">This is an optional Request component that runs on either the instance or a <span class="ph">MID Server</span>.</p> </dd> <dt class="dt dlterm">REST or SOAP step</dt> <dd class="dd"><p class="p">Send a REST or SOAP request to a third-party API. Select a data format to add an associated step to the <span class="ph">Data Stream</span> action. For more information, see <a class="xref" href="../../flow-designer/reference/rest-request-action-designer.html" title="Send an outbound REST web service request to an external system.">REST step</a> and <a class="xref" href="../../flow-designer/reference/soap-step-action-designer.html" title="Enable action designers to send outbound SOAP web service requests to external systems.">SOAP step</a>.</p> <p class="p">This is a mandatory Request component that runs on either the instance or a <span class="ph">MID Server</span>.</p> </dd> <dt class="dt dlterm">JDBC step</dt> <dd class="dd"><p class="p">Send a JDBC request to a third-party API. Use transform script to format data and add an associated step to the <span class="ph">Data Stream</span> action. For more information, see <a class="xref" href="../../flow-designer/reference/jdbc-step.html" title="Create a reusable action to send SQL commands to a relational database.">JDBC step</a> and <a class="xref" href="../../flow-designer/task/test-jdbc-step.html" title="Test the JDBC step before testing or publishing an action that contains the JDBC step.">Test JDBC step</a>. All data is retrieved and pagination is not needed.</p> <p class="p">This is a mandatory Request component that runs on a <span class="ph">MID Server</span>.</p> </dd> </dl> </div> </div> <div class="section" id="data-stream-actions__section_pkp_wws_tgb"><h2 class="title sectiontitle">Parsing in REST and SOAP steps</h2> <div class="p">Use the Parsing category to configure how the action separates data stream elements into complex data objects. Use the Splitter step to identify and separate items from an XML or JSON stream, and use the Script Parser step to transform each item into a complex object. The Parsing section executes once per item in the stream. You can access outputs from previous steps in your data stream action using the <span class="keyword apiname">fd_data</span> object, excluding:<ul class="ul" id="data-stream-actions__ul_e3d_bdb_plb"><li class="li">REST or SOAP step Response Body, Stream, or Error Message outputs</li><li class="li">Splitter step outputs</li></ul> </div> <p class="p"><img class="image" id="data-stream-actions__image_udm_jzt_rhb" src="../images/data-stream-split-parse.png" alt="Splitting and parsing a stream of user records." /></p> <p class="p">For more information about complex data, see <a class="xref" href="../administer/flow-designer/concept/complex-data.dita/complex-data.html" target="_blank" rel="noopener noreferrer">Complex data</a>. Parsing components provide these configuration options.</p> <div class="p"><dl class="dl"> <dt class="dt dlterm">Splitter step</dt> <dd class="dd"><p class="p">Identify <span class="ph">the parent node in the response stream to map to a complex object. For example, identify a user element in an XML payload to create a complex object for each user in the response stream. </span></p> <p class="p">Select a splitter type to identify and separate repeated items in an XML or JSON data stream.</p> <div class="p"><ul class="ul" id="data-stream-actions__ul_egw_4p2_fhb"><li class="li"><span class="ph uicontrol">JSON</span>: Identifies objects from a stream of JSON data. Use a JSONPath expression to identify a JSON array containing repeated data.</li><li class="li"><span class="ph uicontrol">XML</span>: Identify objects from a stream of XML data. Use an XPath expression to identify an XML element containing repeated data.</li></ul> </div> <p class="p">This is a mandatory Parsing component that only runs on the instance.</p> </dd> <dt class="dt dlterm">Script Parser step</dt> <dd class="dd"><p class="p">Use <span class="ph">JavaScript and <span class="ph">ServiceNow</span> APIs to map items in the response stream to a complex object output represented by the <code class="ph codeph">targetObject</code> global object. For example, map incident record elements identified in the splitter step to a complex object containing incident fields. If the data stream includes siblings to the item identified in the splitter step that you do not want mapped to a complex object, include conditions to exclude those items.</span></p> <p class="p">This is a mandatory Parsing component that only runs on the instance.</p> </dd> </dl> </div> <div class="p"><div class="fig fignone" id="data-stream-actions__fig_yhd_ly5_mlb"><span class="figcap"><span class="fig--title-label">Figure 3. </span>REST and SOAP Data Stream action overview</span> <img class="image" id="data-stream-actions__image_bqf_jy5_mlb" src="../images/ds-action-diagram.png" alt="Overview of the REST and SOAP Data Stream action." /> </div> </div> </div> <div class="section" id="data-stream-actions__section_sqs_rgj_h4b"><h2 class="title sectiontitle">Transform script in JDBC step</h2> <p class="p">JDBC data stream action doesn't require pagination. Also, splitter and parser steps aren't required.</p> <div class="p">The JDBC step generates a complex object for each of the retrieved record. Hence, action preprocessing and transform script in the JDBC data stream action are optional. When using the transform script, action designer must specify the internal name of the table columns in the transform script.<div class="fig fignone" id="data-stream-actions__fig_oj1_blk_h4b"><span class="figcap"><span class="fig--title-label">Figure 4. </span>JDBC Data Stream action overview</span> <img class="image" id="data-stream-actions__image_pj1_blk_h4b" src="../images/data-stream-jdbc.png" alt="Overview of the JDBC Data Stream action." /> </div> </div> </div> <div class="section" id="data-stream-actions__section_j4k_rpz_c3b"><h2 class="title sectiontitle">Data Stream outputs in SOAP and REST steps</h2> <p class="p">When designing a <span class="ph">Data Stream</span> action, you must create a single output of type Object or Dynamic Object. The Script Parser step maps items in the stream to this object using the <code class="ph codeph">targetObject</code> global object.</p> <p class="p">At runtime, the system splits and parses the stream of response data according to the <span class="ph">Data Stream</span> configuration. Each item in the stream maps to the complex object structure defined by the Script Parser step and the object output, resulting in a large series of complex objects. For more information about complex data, see <a class="xref" href="../administer/flow-designer/concept/complex-data.dita/complex-data.html" target="_blank" rel="noopener noreferrer">Complex data</a>.</p> </div> <div class="section" id="data-stream-actions__section_j23_glk_h4b"><h2 class="title sectiontitle">Data Stream outputs in JDBC step</h2> <div class="p">The output of JDBC steps is a complex object stream. Entire data is retrieved in one request only.<div class="note"><span class="notetitle">Note:</span> <ul class="ul" id="data-stream-actions__ul_a3y_1mk_h4b"><li class="li">You can only retrieve data and can't update or delete records using the JDBC data stream action.</li><li class="li">The fields, <span class="ph uicontrol">Maximum Row</span> and <span class="ph uicontrol">Maximum Payload Size (KB)</span> that are available in JDBC step aren't available in the JDBC data stream action.</li></ul> </div> </div> </div> <div class="section" id="data-stream-actions__section_if2_rs2_1hb"><h2 class="title sectiontitle">Execution details in REST and SOAP steps</h2> <p class="p">View the configuration and runtime results for each item processed by a <span class="ph">Data Stream</span> action. Select a record number to see its configuration and runtime details. By default, the execution details include requests for the last 1000 items. To change the number of items in the execution details, update the <span class="keyword parmname">com.snc.process_flow.reporting.datastream.item.lastn</span> system property.</p> <p class="p"><img class="image" id="data-stream-actions__image_ohp_5bb_nhb" src="../images/ds-execution-details.png" alt="Execution details for a Data Stream action." /></p> <div class="p"><dl class="dl"> <dt class="dt dlterm">Data stream summary</dt> <dd class="dd"><p class="p">View an overview of the execution that includes this information.</p> <div class="p"><ul class="ul" id="data-stream-actions__ul_wbb_scb_nhb"><li class="li"><span class="ph uicontrol">Page count</span>: Number of pages returned by a paginated API.</li><li class="li"><span class="ph uicontrol">Total item count</span>: Number of items in the response stream mapped to complex object outputs.</li><li class="li"><span class="ph uicontrol">Error count</span>: Number of errors encountered.</li></ul> </div> </dd> <dt class="dt dlterm">Page details</dt> <dd class="dd"><p class="p">View runtime data for each step within the <span class="ph">Data Stream</span> action. Select a page to view runtime details for each request to a paginated API. By default, the execution details include requests for the last five pages. To change the number of requests in the execution details, update the <span class="keyword parmname">com.snc.process_flow.page.reporting.lastn</span> system property. Set the value to 0 to remove pages from the execution details and -1 to include all pages.</p> <div class="p"><div class="note"><span class="notetitle">Note:</span> Including all pages can affect performance and is not recommended.</div> </div> <p class="p"><img class="image" id="data-stream-actions__image_ixz_fcb_nhb" src="../images/ds-pagination-execution-details.png" alt="Runtime details" /></p> </dd> </dl> </div> </div> <div class="section" id="data-stream-actions__section_edv_3nk_h4b"><h2 class="title sectiontitle">Execution details in JDBC step</h2> <p class="p">Construction of the output complex object schema isn't needed for the JDBC data stream action. You can test the query and see the query result. See <a class="xref" href="../../flow-designer/task/test-jdbc-step.html" title="Test the JDBC step before testing or publishing an action that contains the JDBC step.">Test JDBC step</a> for more information. Configure the <span class="ph">MID Server</span> properties <span class="keyword parmname">mid.jdbc.datastream.max.record.size</span> and <span class="keyword parmname">mid.jdbc.datastream.fail.when.attachement.limit.exceeded</span> to retrieve data as per your requirement. See <a class="xref" href="../product/mid-server/reference/r_MIDServerProperties.dita/r_MIDServerProperties.html" target="_blank" rel="noopener noreferrer">MID Server properties</a> for more information.</p> </div> </div> <div class="related-links"> <ul class="ullinks"><li class="link ulchildlink"><strong><a href="../../../administer/integrationhub/concept/data-stream-design.html">Data Stream action design considerations</a></strong><br /> Follow these considerations when creating a <span class="ph">Data Stream</span> action and when adding a <span class="ph">Data Stream</span> action to a flow to prevent errors and performance issues.</li><li class="link ulchildlink"><strong><a href="../../../administer/integrationhub/concept/dsa-on-mid.html">MID Server support for Data Stream actions</a></strong><br /> <span class="ph">Get data through a <span class="ph">ServiceNow®</span> <span class="ph">MID Server</span> when running a <span class="ph">Data Stream</span> action.</span></li><li class="link ulchildlink"><strong><a href="../../../administer/integrationhub/tasks/create-data-stream-action.html">Create a Data Stream action</a></strong><br /> Create a reusable action to process a stream of response data within a flow.</li><li class="link ulchildlink"><strong><a href="../../../administer/integrationhub/tasks/test-data-stream-action.html">Test a Data Stream action</a></strong><br /> <span class="ph">Test your <span class="ph">Data Stream</span> action to ensure that it works the way you expect before you add it to a flow.</span></li><li class="link ulchildlink"><strong><a href="../../../administer/integrationhub/tasks/use-data-stream-in-flow.html">Use a Data Stream action in a flow</a></strong><br /> <span class="ph">Data Stream</span> actions use the <span class="ph uicontrol">For each</span> flow logic option to process stream data in a flow. For example, suppose that you want to use a <span class="ph">Data Stream</span> action that imports document data from a third-party site. When added to a flow, the action appears as a <span class="ph uicontrol">For each</span> flow logic block, enabling flow designers to easily create a record in <span class="ph">ServiceNow</span> for each object in the data stream.</li></ul> <div class="familylinks"> <div class="parentlink"><strong>Parent Topic:</strong> <a class="link" href="../../../administer/integrationhub/concept/integrationhub.html" title="Automate integration tasks using ServiceNow components for Flow Designer, or develop custom integrations. A separate subscription is required.">Integration Hub</a></div> </div> </div></body></html></div>