You are here:
Show Promotions Based on Transaction Currency in Multicurrency Orgs (Beta)
Complete this optional setup to show promotions based on the transaction’s currency. By default, when you use multiple currencies in your org, the Browse Catalogs window shows promotions based on the currency of the account associated with the transaction.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Unlimited, and Developer Editions of Agentforce Revenue Management with the Revenue Cloud Advanced license, and the Global Promotions Management Basic Add-On license or Loyalty Management - Growth or Advanced license. |
| User Permissions Needed | |
|---|---|
| To customize context definitions: | Context Service Admin |
| To customize flows: | Manage Flows |
Important
You can show promotions based on the transaction currency only if you haven’t set up channel-based promotions.
Configure the Product Discovery Context Definition
Change the definition to show promotions based on the transaction currency.
-
Edit your extended Product Discovery context definition.
- From Setup, find and select Context Definitions.
- Click Custom Definitions.
-
Click your extended Product Discovery context definition.
If you’re using the prebuilt context definition, extend your ProductDiscoveryContext context definition.
- Click Edit.
- On the Edit Context Definitions page, click Next.
-
On the Edit Structure page, click
next to Promotion__std.
- For name, enter Transaction__c, and click Next.
- Click Transaction__c.
-
Click Add Attributes and add the currency details.
- For name, enter ccycode__c.
- For Type, select INPUT OUTPUT
- For Data Type, select STRING.
-
Click Add Attributes and add the account details.
- For name, enter accountId__c.
- For Type, select INPUT OUTPUT.
- For Data Type, select STRING.
-
Click Add Attributes and add the ID details.
- For name, enter id__c.
- For Type, select INPUT OUTPUT.
- For Data Type, select STRING.
- Click Next.
-
On the Edit Attribute Tags page, add the attribute names as tag names.
- Next to accountId__c, click Add Tags.
- For tag name, enter accountId__c.
- Click Done.
-
Repeat these steps to add tags for ccycode__c and id__c.
Use the attribute name as the tag name.
- Save your changes.
Create a Custom Promotions Mapping
- Open the Map Data tab.
-
Next to ProductDiscoveryPromoMapping, click
and select Clone.
- Enter a name, and save your changes.
- Delete the mapping between the Account node and the SalesTransaction node.
-
Map these nodes and attributes.
Product Discovery Context Sales Transaction Context Transaction__c SalesTransaction ccycode__c CurrencyIsoCode accountId__c Account - Save your changes.
-
Next to ProductDiscoveryMapping, click
and select Edit Input Mapping.
- Click Generate Node Mappings.
- In the Generate node mappings window, click Retain and Generate.
- Save your changes.
- Activate your context definition.
Create an Apex Class
Create an Apex class for a flow action.
-
Click
and select Developer Console.
- Select File | New | Apex Class.
- For name, enter DiscoverProductFlowAction.
-
Add this code, and save your changes.
public class DiscoverProductFlowAction { // Define input parameters public class FlowInput { @InvocableVariable(required=false) public String objectApiName; @InvocableVariable(required=false) public String recordId; } // Define output parameters public class FlowOutput { @InvocableVariable public runtime_industries_cpq.ContextDataInput[] additionalContextData; } // This method is invoked from a flow @InvocableMethod(label='Process Input' description='Creates the Array of ContextDataInput for additional Context Data') public static List<FlowOutput> generateAdditionalContextData(List<FlowInput> inputs) { String objectApiName; String recordId; String ccyCode; String accountId; Quote quoteObject; Order orderObject; FlowOutput output = new FlowOutput(); // Capture input from the flow for(FlowInput input : inputs ){ objectApiName = input.objectApiName; recordId = input.recordId; } //Write logic to Query Currency from Transaction Entity if(objectApiName == 'Quote') { quoteObject = [SELECT CurrencyIsoCode,AccountId FROM Quote WHERE Id = :recordId LIMIT 1][0]; ccyCode = quoteObject.CurrencyIsoCode; accountId = quoteObject.AccountId; } else if(objectApiName == 'Order') { orderObject = [SELECT CurrencyIsoCode,AccountId FROM Order WHERE Id = :recordId LIMIT 1]; ccyCode = orderObject.CurrencyIsoCode; accountId = orderObject.AccountId; } //Populate the ContextDataInput list to store additional context data List<runtime_industries_cpq.ContextDataInput> listContextData = new List<runtime_industries_cpq.ContextDataInput>(); runtime_industries_cpq.ContextDataInput cd1 = new runtime_industries_cpq.ContextDataInput(); cd1.nodeName = 'Transaction'; //Where Quote is the name of the node in the context definition. cd1.nodeData = new Map<String,Object>(); cd1.nodeData.put('id',recordId); cd1.nodeData.put('ccycode',ccyCode); cd1.nodeData.put('accountId',accountId); listContextData.add(cd1); // Return the additional Context Data to a flow output.additionalContextData = listContextData; return new List<FlowOutput>{output}; } }
Customize the Product Discovery Flow
- In Setup, find and select Flows.
-
Open your Product Discovery flow.
If you’re using the default flow, open Discover Products.
-
Before the Product list screen element, click
and select Action.
- Enter a label and API name.
- Find and select DiscoverProductFlowAction.
- Turn on objectAPIName, and enter objectAPIName as its value.
- Turn on recordId, and enter recordId as its value.
- Save your changes.
- Click Product list.
- Click Product List Page Container.
- For the Context Data Input Array attribute, select the output of the action.
- Save your changes.
- Activate the flow.
Did this article solve your issue?
Let us know so we can improve!

