Freebie Condition: LevelFormula__c Field Specification
| Available for instances with the enabled Web Service. |
Level Formula allows adding freebies based not only on the number of products, but also on the product amount. Also, the required quantity can be calculated using constants or additional fields, such as the Freebie Value field.
Examples
Example of complex calculation:
{
"operator": "sum",
"items": [
{
"operator": "multi",
"items": [
"orders__QuantityFromPreviousOrders__c",
"$.quantity"
]
}
]
}
Example of a calculation with multiplication and minus:
{
"operator": "multi",
"items": [
"$.quantity",
"-orders__QuantityFromPreviousOrders__c",
]
}
Example of a calculation with division and cutDecimalsTo:
{
"operator": "divide",
"cutDecimalsTo" : 0
"items": [
"$.totalPrice",
300
]
}
JSON Key Description
| Key | Type | Required | Comment | ||
|---|---|---|---|---|---|
cutDecimalsTo |
Number |
No |
The optional operator truncates the number of the decimal places on the resulting value after the operations with items. It can be used in pair with roundTo after rounding. |
||
items |
Array |
Yes |
Is used in calculations.
|
||
operator |
Enum |
Yes |
The arithmetic operation:
|
||
roundTo |
Number |
No |
The optional and rounds the number of decimals on the resulting value after the operations with items. It can be used in pair with cutDecimalsTo before truncating to the required number of decimal places. |