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: queryApi
url: ../openapi/salesforce-sales-cloud-query-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:
- condition: $response.body#/done == false
- name: complete
type: end
criteria:
- condition: $response.body#/done == true
- 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
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.