The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Post Offer Details for an Anonymous User

This example demonstrates how to add promotions.

Ensure you have:

  • Created a catalog that contains both products and promotions.

  • Set the CacheAPIPartialConfigure custom setting to true. Also, ensure you have set the CacheAPIFields custom setting to true. You set custom parameters in Vlocity CMT Administration -> CPQ Configuration Setup.

  • Run the appropriate Cacheable API batch jobs. From the Vlocity CMT Administration > Cacheable API Jobs screen, run the Load API Metadata job. Running this job populates metadata to the metadata classes and also some metadata settings.

  • Run the Populate API Cache job by clicking Start. From the Populate API Cache window, select GetOfferDetails and GetPrices.

You can use the Configure Offer API with a two-step process to easily configure an offer.

  1. Execute the API with a GET method to retrieve the offer details structure. For example:

  2. After receiving a result from the API call, copy the result and use it as the body for the POST call. Before executing the POST call, remove the contextKey from the body, then edit any of the body parameters as appropriate to configure the offer. When finished, execute the call and verify that the result is as expected.

  3. The next step applies validation rules, pricing, and updates the response with the PromoDetails structure. In the response from the previous step, under the validateAndPriceAction, you will see the transactionKey REST parameter. Add the transactionKey in the request body to make the request. In the following example, the request body has been truncated for clarity.

    The forceinvalidatecache parameter is used only for debugging purposes. When enabled by a server setting, forceinvalidatecache=true forces a cache refresh.