You are here:
Use Salesforce CPQ Context Rules to Fetch Products
Salesforce CPQ's context rules are used to retrieve Digital media products. To enable context rules to fetch digital media products, you must create a data mapper, configure an integration procedure, and then ensure that the isProductFetchServerEnabled custom setting is configured.
This is an Advertising Sales Management on Managed Package feature. For Advertising Sales
Management on Salesforce Platform, see Advertising
Sales Management on Salesforce Platform.
| REQUIRED EDITIONS |
|---|
| Available in: Lightning Experience |
| Available in: all editions |
| REQUIRED USER PERMISSIONS | |
|---|---|
| To access Media Cloud advanced features: | MediaCloudPlus Runtime |
| To create, read, update, and delete Flexcards: | Omnistudio Admin |
To use the context rules, you must use server-side mode. The cache mode doesn’t support context rules.
-
Create an Omnistudio Data Mapper Transform with these details:
- Name: FilterQualifiedProducts
- Interface Type: Transform
- Input Type: JSON
- Output Type: JSON
See Create an Omnistudio Data Mapper Transform if you are working with Omnistudio or Create an Omnistudio Data Mapper Transform in Omnistudio for Managed Packages if you are using Omnistudio for Managed Packages. -
Add these formulas in the specified sequence:
Sequence Number Formula Formula Result Path 1 LIST(%GetCartProducts:messages%) Messages 2 FILTER(LIST(%GetCartProducts:records%), 'category == "Qualified"') FilteredProductsList 3 IF(ISBLANK(FilteredProductsList),0,LISTSIZE(FilteredProductsList)) TotalQualifiedProducts 4 %GetCartProducts:totalSize% - TotalQualifiedProducts TotalDisqualifiedProducts See Use Formulas in Omnistudio Data Mappers if you are working with Omnistudio or Use Formulas in Omnistudio Data Mappers in Omnistudio for Managed Packages if you are using Omnistudio for Managed Packages. -
Map the result of each formula to the output structure:
Input JSON Path Output JSON Path Output Data Type Messages GetCartProductsFiltered:messages List<Map> FilteredProductsList GetCartProductsFiltered:records List<Map> TotalDisqualifiedProducts GetCartProductsFiltered:totalDisqualifiedProducts N/A TotalQualifiedProducts GetCartProductsFiltered:totalSize See Use Formulas in Omnistudio Data Mappers if you are working with Omnistudio or Use Formulas in Omnistudio Data Mappers in Omnistudio for Managed Packages if you are using Omnistudio for Managed Packages. -
Open the latest version of the vplAds/GetCartProducts integration procedure.
If your latest version of the integration procedure is active, deactivate it first.
-
Open the GetProducts element and add this key/value pair:
Key includeIneligible Value true -
Add Data Mapper Transform Action element after the GetProducts element and specify
these details:
Element Name GetQualifiedProducts Data Maper Interface FilterQualifiedProducts Send JSON Path %GetProducts% Send JSON Node GetCartProducts Response JSON Path GetCartProductsFiltered -
Open the SuccessResponse element and make these changes:
- Update the value of the GetProducts key to %GetQualifiedProducts%.
-
Update the value of the Execution Conditional Formula to:
ISNOTBLANK(%offset%) AND (%GetQualifiedProducts:totalSize% > 0 OR (%GetQualifiedProducts:totalSize% == 0 AND %GetQualifiedProducts:messages|1:code% == '101') OR (%GetQualifiedProducts:totalSize% == 0 AND %GetQualifiedProducts:totalDisqualifiedProducts% > 0
-
Open the FailureResponse element and make these changes:
- Update the value of the Send JSON Path to GetQualifiedProducts.
-
Update the value of the Execution Conditional Formula to:
%GetQualifiedProducts:totalSize% == 0
-
From Setup, open the Media Configuration custom setting and click
Manage.
- Click isProductFetchServerEnabled.
- Click Edit and select Setup Value.
- Save your changes.
If you can't find isProductFetchServerEnabled in the Media Configuration custom setting, then you must create it with the specified values.

