Use Promotion Business Objects API
Promotion Business Object API can be accessed through REST API, Aura Components, and Lightning Web Component.
Use an external system (such as cURL, Postman, or middleware) to call this API. These endpoints are designed for external integration and cannot be invoked from Apex code within the same org (such as Execute Anonymous, Flows, or Triggers using Http.send()) due to Salesforce platform restrictions on loopback callouts. If attempted, the platform returns a “Callout loop not allowed” error.
To process records with Promotion BO API, you need to use the provided REST endpoints in the defined process:
-
Initialize a transaction with the number of records to process:
-
URL: <ORG INSTANCE>/services/apexrest/cgcloud/promotions/initialize
METHOD: POST
PAYLOAD:
To prevent flagging all promotions in a transaction as calculation errors, set
nrOfItemsto the exact number of promotions to be processed. -
This request returns an import ID that should be passed to every subsequent requests.
-
-
Queue the records to process in blocks of 50 records.
-
URL: <ORG INSTANCE>/services/apexrest/cgcloud/promotions/ingest
METHOD: POST
PAYLOAD:
-
Each call can contain up to 50 records.
-
You can send as many requests to fill the “nrOfItems” defined in the request sent to initialize a transaction.
-
-
Monitor the process.
-
URL: <ORG INSTANCE>/services/apexrest/cgcloud/promotions/status?importId=<import Id>
METHOD: GET
-
This returns the status for all records part of the transaction.
-
You can send requests to the Promotion BO API from an Aura Component.
Component markup
Component controller
Only available when Lightning Web Security is enabled in the organization.
Component controller