Attribute Based Pricing
Info
Method name: AttributeBasedPricing
Written from scratch, alternative, performant and scalable implementation of Attribute Based Pricing. Can be used with any matrix, including standard AttributePricingMatrix
. It is enhanced to accept additional input parameters - eg. customer class, and store additional outputs - eg. minimum price or cost. Put this step before all default pricing steps (set sequence less than 10).
Algorithm is using hash codes to find matching record for each item in the cart and populate pricing variables. Configuration is not hidden anymore, you can access it in custom settings: sfix__AttributeBasedPricing__c
. It is possible to enter it manually (might be an option for huge matrices with millions of records) but recommended way is to populate it by running batch job:
Database.executeBatch( new sfix.AttributeBasedPricingJob('AttributeBasedPricing') );
For performance reasons put this step before any OOTB pricing steps, so that for cart items priced with attribute based pricing, and the regular pricing will not be ran.
All input attributes have to be specified in
Characteristic Name
andCharacteristic Value
columns in calculation matrix (and must not be configured in Pricing Plan Step parameters). In contrast to that, all input fields have to be configured in Pricinp Plan step paramenters (and must not be listed inCharacteristic Name
andCharacteristic Value
columns of calculation matrix).
Calculation Matrix Configuration
-
Typical matrix (MRC & NRC declared as output, all others as input):
Product Name Product Code Characteristic Name Characteristic Value MRC NRC Sample Product PRD_SAMPLE ATTR1;ATTR2 some value;other value 110 200 … … … … … … Note: each matrix row can have different combination of attributes
-
Matrix with additional input field (MRC & NRC declared as output, all others as input):
Product Name Product Code Characteristic Name Characteristic Value Column Name MRC NRC Sample Product PRD_SAMPLE ATTR1;ATTR2 some value;other value field value 110 200 … … … … … … … Note: mapping of field name to column name is done in pricing plan step configuration
-
Matrix with additional input field (Some other output declared as output):
Product Name Product Code Characteristic Name Characteristic Value MRC NRC Some other output Sample Product PRD_SAMPLE ATTR1;ATTR2 some value;other value 110 200 output value … … … … … … … Note: mapping of column name to attribute, field or pricing variable is done in pricing plan step configuration
-
Matrix with parent item attributes (Parent Characteristic Name & Parent Characteristic Value declared as input):
Product Name Product Code Characteristic Name Characteristic Value Parent Characteristic Name Parent Characteristic Value MRC NRC Sample Product PRD_SAMPLE ATTR1;ATTR2 some value;other value ATTR3 parent attr value 110 200 … … … … … … … … Note: parent characteristics will be processed automatically, there is no need for any additional mapping
-
All above patterns can be combined, eg. single matrix can have:
- multiple additional input fields
- multiple additional outputs
- parent characteristics
Note: make sure to create matrix row for each valid combination of attributes and fields
Configuration
Pricing plan step setting:
This example configuration will perform typical attribute based pricing:
Following configuration will read 2 additional output columns from attribute based pricing (in the matrix configure 2 additional output columns named MIN
& CST
):
Configuration below shows how to provide additional input column for attribute based pricing (in the matrix configure 1 additional input column named Segment
):
Here is configuration illustrating how to reference a field value from Parent Line Item (ParentItem.SomeFieldName__c
):
NEW Here is configuration for storing output of calculation matrix in an attribute. To save value of attribute in cart line item use AttributeUpdate
pricing plan step after all attribute based pricing steps (to have just 1 serialization operation for all pricing plan steps):
All mapping of input and output matrix columns is done automatically, based on matrix definition. As output specify pricing variables. Configure pricing variable bindings to store ouptut values in fields.
Params
As params provide:
MatrixName
: name of the matrix, highest priority will be automatically selected- mappings of all input and output matrix columns - except for
Characteristic Name
andCharacteristic Value
- these inputs will be mapped automatically from JSONAttribute field based on matrix configuration - CPQ setting
AttrMatrixInfoCachePartition
will be used to find general cache forAttributePricingMatrix
- When set, CPQ setting
PricingPlanStepCachePartition
will be used to store specific cache