Adding a Condition (2.6)

For the newly created Calculation Type record, you will need to specify the conditions to calculate fees for products in order.

  1. On the created Calculation Type page, click New in the Conditions section.

  2. Enter the following:

    • Order: 10.

      The field is responsible for the order in which Conditions of Calculation Type are applied. Since we only use one Condition in the workshop, you can specify any value in this field.
    • Set Active.

    • Condition Details: add this JSON, according to which the condition with discount will trigger for the product, which is not a promotional product:

      In the field key, you may either specify orders__PromotionId__r.orders__ExternalId__c or orders__PromotionId__c, depending on whether your products have External Id.
      {
         "conditions":{
            "operator":"AND",
            "items":[
               {
                  "field":"orders__PromotionId__r.orders__ExternalId__c",
                  "operator":"equal",
                  "value":""
               }
            ]
         }
      }
    • Calculation Method: Advanced.

    • Discount Rate Location: Level Records.

    • Advanced Criteria: add this JSON, according to which the condition with discount will trigger for the product, which is not a promotional product:

      In the field key, you may either specify orders__PromotionId__r.orders__ExternalId__c or orders__PromotionId__c, depending on whether your products have External Id.
      {
         "levelConditions":{
            "operator":"AND",
            "productCount":{
               "filter":{
                  "operator":"AND",
                  "items":[
                     {
                        "field":"orders__PromotionId__r.orders__ExternalId__c",
                        "operator":"equal",
                        "value":""
                     }
                  ]
               },
               "minCount":1
            },
            "requiredProducts":{
               "productIdField":"orders__ProductId__r.CTCPG__ExternalId__c",
               "operator":"AND",
               "items":[
      
               ]
            }
         },
         "levelBasedOnFilter":{
            "operator":"AND",
            "items":[
               {
                  "field":"orders__PromotionId__r.orders__ExternalId__c",
                  "operator":"equal",
                  "value":""
               }
            ]
         }
      }
      Condition 2.6
  3. Click Save.

The Condition record is created.

``