arazzo: 1.0.1 info: title: Salesforce Sales Cloud Paginated SOQL Export summary: Run a large SOQL query, then page to the next batch when the first is not complete. description: >- A pagination pattern over the Query resource. The workflow runs a SOQL query and inspects the done flag; when more results remain it derives the query locator from the nextRecordsUrl and fetches the next batch, otherwise it ends after the first page. Every step inlines its request and the OAuth bearer Authorization header. version: 1.0.0 sourceDescriptions: - name: restApi url: ../openapi/salesforce-sales-cloud-rest-api-openapi.yml type: openapi workflows: - workflowId: paginated-soql-export summary: Execute a SOQL query and fetch the next batch when not done. description: >- Runs the supplied SOQL query, branches on the done flag, and when more records remain retrieves the next batch using the query locator. inputs: type: object required: - accessToken - query - queryLocator properties: accessToken: type: string description: OAuth 2.0 access token used as the Bearer credential. query: type: string description: The SOQL query string to execute. queryLocator: type: string description: >- The query locator (the identifier at the end of nextRecordsUrl) used to fetch the next batch when the first page is not done. steps: - stepId: runQuery description: Execute the SOQL query and read the first batch. operationId: executeSOQLQuery parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: q in: query value: $inputs.query successCriteria: - condition: $statusCode == 200 outputs: done: $response.body#/done totalSize: $response.body#/totalSize nextRecordsUrl: $response.body#/nextRecordsUrl onSuccess: - name: morePages type: goto stepId: nextBatch criteria: - context: $response.body condition: $.done == false type: jsonpath - name: complete type: end criteria: - context: $response.body condition: $.done == true type: jsonpath - stepId: nextBatch description: Retrieve the next batch of results using the query locator. operationId: getNextQueryResults parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: queryLocator in: path value: $inputs.queryLocator successCriteria: - condition: $statusCode == 200 outputs: done: $response.body#/done records: $response.body#/records outputs: firstBatchDone: $steps.runQuery.outputs.done totalSize: $steps.runQuery.outputs.totalSize nextBatchRecords: $steps.nextBatch.outputs.records