Steps
The updated Pricing Procedure v. 2.0 with pricing procedure steps that enrich the control over the calculation algorithm and allow recording intermediate values calculated for each record of the Delivery Line Item.
Sample Syntax
-
Sample Syntax
-
Commentary
{
"version": 2,
"steps": [
{
"type": "procedure",
"basePrice": "$.listPrice",
"resultPrice": "$.unitPrice",
"procedure": {
"type": "MULT",
"round": "item",
"roundTo": 4,
"items": [
{
"calculationType": "structural"
},
{
"calculationType": "contract"
},
{
"type": "MAX",
"items": [
{
"calculationType": "season"
},
{
"calculationType": "promo_percent"
}
]
}
]
}
},
{
"type": "setValue",
"object": "orders__DeliveryLineItem__c",
"resultPrice": "$.unitPrice",
"condition": {
"operator": "AND",
"items": [
{
"field": "$.unitPrice",
"operator": "less",
"value": 0
}
]
},
"value": 0
},
{
"type": "rollUp",
"baseObject": "orders__DeliveryLineItem__c",
"basePrice": "$.unitPrice",
"method": "copyEqual",
"result": [
{
"resultObject": "orders__OrderLineItem__c",
"resultPrice": "$.unitPrice"
}
]
},
{
"type": "setValue",
"object": "orders__DeliveryLineItem__c",
"resultPrice": "$.totalPrice",
"value": {
"operator": "multi",
"items": [
"$.unitPrice",
"$.quantity"
]
}
},
{
"type": "rollUp",
"baseObject": "orders__DeliveryLineItem__c",
"basePrice": "$.totalPrice",
"method": "sum",
"result": [
{
"resultObject": "orders__Order__c",
"resultPrice": "$.totalPrice"
},
{
"resultObject": "orders__Delivery__c",
"resultPrice": "$.totalPrice"
},
{
"resultObject": "orders__OrderLineItem__c",
"resultPrice": "$.totalPrice"
}
]
},
{
"type": "setValue",
"object": "orders__DeliveryLineItem__c",
"resultPrice": "$.totalDiscount",
"value": {
"operator": "multi",
"items": [
{
"operator": "sum",
"items": [
"$.listPrice",
"- $.unitPrice"
]
},
"$.quantity"
]
}
},
{
"type": "rollUp",
"baseObject": "orders__DeliveryLineItem__c",
"basePrice": "$.totalDiscount",
"method": "sum",
"result": [
{
"resultObject": "orders__Order__c",
"resultPrice": "$.totalDiscount"
},
{
"resultObject": "orders__Delivery__c",
"resultPrice": "$.totalDiscount"
},
{
"resultObject": "orders__OrderLineItem__c",
"resultPrice": "$.totalDiscount"
}
]
}
]
}
{
"version": "value",
"steps": [
{
"type": "procedure" // beginning of the first step;
"basePrice": "$.listPrice", // the name of the field for the actual price source;
"resultPrice": "$.unitPrice", // the name of the field for the calculation end results;
"procedure": { // beginning of the procedure within the first step;
"type"(operation type):"value", // MIN or MAX or MULT or SUM
"round":"value", // "item" or "group"
"roundTo":"value", // the number of decimals
"items": [ // an array of the calculated discounts;
{
"calculationType":"external id of the discount 1"
},
{
"calculationType":"external id of the discount 2"
}
]
}
}
]
}
JSON Key Description
| Key | Type | Required | Comment | ||
|---|---|---|---|---|---|
steps |
Array |
Yes |
At least one item must be provided. |
||
version |
Number |
Yes |
Constant: 2.
|