Add Custom Attributes to Penny Perfect Pricing Context
Use pricing context definitions to add custom attributes for penny pricing calculations in Consumer Goods Cloud. Use custom attributes to refine condition searches or extend logic in user exits.
Required Editions
| Available in: Lightning Experience in Enterprise and Unlimited Editions that have Consumer Goods Cloud enabled |
| User Permissions Needed | |
|---|---|
| To add custom attributes: | CGCloud Business Admin OR CGCloud Retail Business Admin |
Considerations for Custom Attributes
Keep these considerations in mind while adding custom attributes by using pricing context definition.
- Use account-related or product-related attributes only for condition searches via key attributes or key types. Salesforce doesn't support account or product-related custom attributes in user exits.
- Define only attributes that aren't already in the core context or pricing context. See Default Context Fields.
- Make sure the combination of Context Section, Source, Reference Field Name, and Sales Org is unique.
- Define valid fields that exist within the source objects.
- Avoid defining field aliases that are available in the core context or pricing context definition. The combination of Context Section, Source, Field Alias, and Sales Org must be unique.
- Define up to 20 attributes per source object and sales org.
- Avoid adding attributes with the long text data type, which can slow pricing condition searches.
- Default Context Fields
The core pricing context includes these fields. To avoid errors, don't use these field or alias names when configuring additional context fields. Account-related and product-related attributes are for condition searches. Only order-related attributes are supported for user exits. - Manage Pricing Context Definition Object Permissions
For the given permission sets, manually configure the object permission settings on the pricing context definition to specify the type of access that users have to the Pricing Context Definition object.
Create a Pricing Context Definition
Define the custom attributes that you want to use in your pricing condition search or user exits.
- From the App Launcher, find and select Pricing Context Definition.
- Click New.
- Enter a name and select a sales org.
-
Select a context section, such as Order Information, Account Information, or Product
Information. This selection defines the pricing context section where you add the new
attribute.
Account-related and product-related attributes are for condition searches. Only order-related attributes are supported for user exits.
-
Select a source object.
Salesforce filters the Source list based on your context section selection.
- Enter a field name (including namespace) that matches the API name of the field in the source object.
-
Enter a field alias.
The alias must be the same for the data source of the offline and online mobile apps.
- Save your changes.
After you define the pricing context, define how the attributes are used.
Custom Attribute in Pricing Condition Search
Customize your pricing logic by using custom attributes to define key attributes and key types that align with specific product or account criteria.
- Create a key attribute with Mobility Attribute as the Field Alias in Pricing Context Definition.
- Create a key type with Distribution Category as To All.
- Create and activate a search strategy.
-
Add a search step:
- Set Customer Hierarchy and Product Hierarchy to No.
- Select Exclusive to stop the search when a match is found.
- Prepare and integrate the pricing conditions.
- Create a pricing condition template and select the search strategy.
- Create an order, calculate the price, and verify the pricing information.
Custom Attribute in User Exit
Use custom attributes in user exits that trigger custom calculation logic during the order process.
- Configure the user exit based on the criteria with the custom attribute.
- Create an order, calculate the price, and verify the pricing information.
/** Affected Results return the modified calculation results
It is a JSON Object with following structure:
currentConditionValue :
Holds the current condition value e.g. 19.99 for a base price
currentCalculationBase :
Holds the base of the calculation ... e.g. if you order 10 items and it is a base price then the calculation base is 20
currentCalculationResult :
Holds the condition result e.g. 399,80 if you order 20 items with base price 19.99
currentTotal:
Holds the current value of the order position/item. For base price it is typically equal to currentCalculationResult
But it can also be different ... e.g. for percentage discounts:
current total before step is 200
condition value is -10. (Percentage)
calculation base is 200 (calculate 10% off of 200)
calculation result -20
current total 180 (200 - 20)
**/
var AffectedResults = {};
switch (UserExitId) {
case "100_CalcResult_BasePrice_ext":
if (Utils.isDefined(ProductAttributes[0].text1) && ProductAttributes[0].text1 === "Empower Cola 1,0 L PET") {
AffectedResults.currentConditionValue = 19.99;
AffectedResults.currentCalculationBase = 20;
AffectedResults.currentCalculationResult = AffectedResults.currentCalculationBase * AffectedResults.currentConditionValue;
AffectedResults.currentTotal = AffectedResults.currentCalculationResult;
}
break;
}
return AffectedResults;
