Promotion Business Object API can be accessed through REST API, Aura Components, and Lightning Web Component.
REST API
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.
Note
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:
1{2 “importId” : ”3121b14e-f370-4c1b-8b09-b9323ea38216”, // Import Id received from previous request.3 “workflow”: “create” // Workflow name to execute4 “salesOrg” : “0001” // Sales org5 “promotions”: [...] // Array of up to 50 records where each record represents a Promotion.6}
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.
1...2const boApi = component.find("bo-api");34// Receives a workflow name and a list of promotion objects5// Supports up to 10000 records6boApi.queue(workflowName, promotionList) 7.then((result) => {8 // Resolves after the promotions have been enqueued for BO API processing9 // returns the import id10 // Promotions are processed asynchronously11});1213// Receives a workflow name and a single promotion14boApi.process(workflowName, promotion) 15.then((result) => {16 // Resolves after the promotion has been processed and committed to database (synchronous)17 // Result contains the processed promotion id 18});19...
Lightning Web Component
Only available when Lightning Web Security is enabled in the organization.
Note
Component controller
1import { process, queue } from 'cgcloud/tpmBoApi';23...4// Receives a workflow name and a list of promotion objects5// Supports up to 10000 records6queue('Promotion', workflowName, promotionList) 7.then((result) => {8 // Resolves after the promotions have been enqueued for BO API processing9 // returns the import id10 // Promotions are processed asynchronously11});1213// Receives a workflow name and a single promotion14process('Promotion', workflowName, promotion) 15.then((result) => {16 // Resolves after the promotion has been processed and committed to database (synchronous)17 // Result contains the processed promotion id 18});19...