Condition: ExceptionCondition__c Field Specification

The orders__ExceptionCondition__c field is used to exclude a condition from the application affecting the discount under the presence of certain products in the order cart.

The Exclude Condition logic is reversed to the Advanced Criteria option. While the Advanced Criteria blocks the application of the discount until the condition requirements are met, Exception Condition is used to block the discount application until the condition is met. At the same time, the logic works with the orders__LevelBasedOn__c option to determine the discount exclusion for a specific Order Line Item or Delivery Line Item and the corresponding object’s quantity. The Exclude Condition logic may be applied for both paid products and freebies.

Example

A JSON example of an exception condition:

{
  "exceptionCondition": {
    "operator": "AND",
    "productCount": {
      "filter": {
        "operator": "AND",
        "items": [
          {
            "field": "RecordType.DeveloperName",
            "operator": "equal",
            "value": "Freebie"

          },
          {
            "field": "orders__ProductId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ParentId__r.CTCPG__ExternalId__c",
            "operator": "equal",
            "value": "40080"

          }

        ]

      },
      "minCount": 3

    },
    "requiredProducts": {
      "productIdField": "orders__ProductId__r.CTCPG__ExternalId__c",
      "operator": "AND",
      "items": [
        {
          "product": "400801877111370E86",
          "minQuantity": 5

        }

      ]

    }

    }
}

JSON Key Description

  • All the unique fields specified in the JSON will be automatically added to the orders__ConditionFieldsList__c on the Calculation Type.

  • If the Exception Condition was altered or deleted, it may require manual removal of some fields in orders__ConditionFieldsList__c in accordance with the changes, if not done automatically.

Exception Condition

Key Type Required Comment

operator

Enum

Yes

Available values:

  • AND

  • OR

productCount

Object

Yes

The condition that must be excluded according to the total amount of mandatory products.

requiredProducts

Object

Yes

The specific mandatory products. The quantity is defined according to the selected operator for the productCount key.

Filter

A filter defines which Delivery Line Items can be used for calculating a unique number of products or required products.

Key Type Required Comment

operator

Enum

Yes

Available values:

  • AND

  • OR

items

An array of Filter Items

Yes

At least one item must be provided.

Filter Items

Only products with a non-zero quantity are counted.
Key Type Required Comment

field

String

Yes

The field from the Delivery Line Item or its parent object for which the operator key is applied.

operator

Enum

Yes

See Item Operators.

value

Boolean

No

A target value for fields with the Boolean type.

Number

A target value for fields with the Currency or Number type.

String

A target value for fields with the Text type.

The key is required when the operator key is not in or notIn.

values

Array of Values

No

the values with the Text type, separated by a comma, for example: ["abc","123"]

At least one item must be provided. The key is required when the in or >notIn.

Minimum Quantity

Key Type Required Comment

minCount

Number

Yes

The minimum quantity of unique products (a unique number of added product items) that must be added to order to exclude the condition. If this number is lower than values from the productCount key then condition will not be excluded).

Required Products

The required products to exclude a condition.

Key Type Required Comment

productField

String

Yes

The identification to search required products.

  • Salesforce Id (by default)

  • External Id (if it is set for all products in an instance)

operator

Enum

Yes

The operator defines how to apply the logic:

  • AND

    The quantity checked for all listed products.

  • OR

    At least the quantity of one product has reached the minimum value.

items

An array of Required Product Items

Yes

The list of required products. See the Required Product Items.

The condition may be satisfied if there are no specified values.

Required Product Items

The list of required products to exclude a condition.

Key Type Required Comment

product

String

Yes

Available values:

  • Salesforce Id

  • External Id (if exist)

minQuantity

Number

Yes

The product minimum quantity.

Item Operators

Field Data Type

Operator

contain

notContain

in

notIn

equal

notEqual

greater

greaterOrEqual

less

lessOrEqual

Currency

No

No

No

No

Yes

Yes

Yes

Yes

Yes

Yes

Number

No

No

No

No

Yes

Yes

Yes

Yes

Yes

Yes

Text

Yes

Yes

Yes

Yes

Yes

Yes

No

No

No

No

``