With the Attribute-based Pricing feature, you can define a price lookup formula on the Product Rate Plan Charge object, which will be used to identify the correct and relevant charge definition based on the context. The price lookup formula is used during order preview to map the lookup attributes from the Account and Subscription objects to the Product Charge Definition object and assign a charge definition to the subscription rate plan charge.
Price lookup formula
The price lookup formula is defined in the following syntax:
lookup("field_name_on_charge_definition" = fieldLookup ("other_object_name", "field_name"))
field_name_on_charge_definitionis the field on the product charge definition object.
other_object_nameis another object that can be supported by price lookup.
field_nameis the field name on another object whose value will be mapped to the charge definition object.
You can define as many field lookups as you want and separate them by commas. For supported lookup fields by the formula, see Supported lookup fields.
The following formula defined for a product rate plan charge is a simple example. It indicates the
state custom field on the Product Charge Definition object will be used to identify the target charge definition, and its value is mapped from the
state field on the account object.
lookup("state__c" = fieldLookup("account", "state__c"))
The following formula is a more complex one. In this example, the
term fields on the Product Charge Definition object are used to identify the target charge definition. The field values are mapped from either the Account object or the Subscription object.
lookup("market__c" = fieldLookup("account", "market__c"), "variant__c" = fieldLookup("subscription", "variant__c"), "soldToRegion__c" = fieldLookup("subscription", "soldToRegion__c"), "termType" = fieldLookup("subscription", "termType"), "termPeriodType" = fieldLookup("subscription", "initialTermPeriodType"), "term" = fieldLookup("subscription", "initialTerm"))
Based on the formula, the lookup function will map the lookup attributes from corresponding objects to the attributes for the charge definition to identify the target charge definition.
- If the lookup function finds only one charge definition that matches all these lookup attributes, this charge definition will be assigned to the subscription rate plan charge.
- If the lookup function finds no charge definition that matches all the lookup attributes, it returns an error.
- If more than one charge definition matches the lookup attributes, the lookup function returns an error.
Price lookup flow
The following diagram explains how price is determined when you subscribe to a product rate plan for your end customer after the Attribute-based Pricing feature is enabled.
The following things happen in sequence in Zuora Billing when you create a subscription for a customer account.
The charge override behavior in Step 5 below is applicable only when an order or order preview is submitted for subscribing to a rate plan.
- A subscription product rate plan is created by cloning the original product rate plan charge.
- The system checks whether there is any charge override.
- If yes, the charge override is applied to the subscription product rate plan.
- If no, skip to the next step.
- The system checks whether a price lookup formula is defined for the product rate plan charge for evaluation.
- If yes, proceed to the next step.
- If no, skip to Step 6 to finalize the subscription rate plan charge.
- The system collects all required information to evaluate the price lookup formula and identify the target product charge definition.
- If the target product charge definition is identified, proceed to the next step.
- If no target product charge definition can be identified or any error occurs, the whole process terminates with errors.
- Based on the following conditions, the system evaluates whether values provided in charge override in an order or order preview should be applied to the subscription rate plan charge.
Whether the attribute value is overridden by the target charge definition
Whether the attribute is present in the order charge override
Evaluation result No Doesn’t matter Does not apply changes Yes Yes Does not apply changes
（It’s because order charge override has higher priority.)
Yes No Apply changes
- The subscription product rate plan charge is finalized.
Supported lookup fields
The following table lists the objects and fields you can use in the price lookup formula.
- The fields on the Product Charge Definition object are to be used before the equal sign in the formula.
- The fields on other objects are to be used after the equal sign in the formula.
|Object||Supported fields for price lookup|
|Product Charge Definition||