Settings>Configurations>Orders>Rules


TABLE OF CONTENTS


Rules Definition

A Rule will return True or False according to the Order's field values. 

There are 2 types of Rules:

  • Script: using an Order Rule Script
  • Value Based: verifying values of fields in the Order

Rules can be used in the Notification Templates to send a notification only when the Rule returns True or False. It can also be used on Fuel Surcharge Schedules when different Fuel Surcharge Tables should be used depending on selected fields in the Order.


Create a Value-Based Rule

1) Click on Settings, Configurations and in Orders sub-menu, click on Rules. 

2) Click on New Order Rule and enter the Rule Name, an optional description, in Type, select Value Based.

3) Rule creation:

Under Values, you will be able to build your Rule by adding filters and groups. You would then choose either AND or OR to decide if all operations must be true to activate the rule, or if only one operation must be true to activate the rule.

Using a Group, you can add multiple sets of operations (filters) with different operators (AND or OR).

You can filter on the Order Account, Vehicle, Service Level, Reference Field values and Hold reason. 

  • If you need more than one set of filter, you will first need to add a group.
    Decide if the combination of all groups should be True, by selecting AND, or if at least one group result should be True, by selecting OR. 
  • Within each group, you will then be able to add your filters, by selecting Add Filter and again, selecting the AND or OR operator. 

4) Once you are done creating your rule, click on Save. 


Example of a Simple Value-Based Rule

Let's say you wanted to build a simple Rule to send out a notification for ASAP Orders for which an Address does not exist.

You would add the Service Level and Hold Reason filters, select the appropriate values, and select And at the top to specify that both of these filters need to be True to trigger the Rule and send out the notification.


Example of a Complicated Value-Based Rule

Let's say you wanted to extend the previous example of a simple rule to incorporate another use case.  You still want to include in the Rule the ASAP Orders with the Addresses that Don't Exist, but you also want to add another use case to trigger the same notification. 

For example, if you wanted to send the same notification when a Same Day Order was Refused by the Occupant of the delivery address, you would configure it as follows:


This Rule configuration ensures that the same Notification will be sent out if EITHER of these statements are true, since you have OR at the top of the page. 



Operators

Depending on the Filter selected (Account, Service Level, Hold Reason, Vehicle or one of the Reference fields) the list of operators will be different.


When using a defined value (Account, Service Level, Vehicle, Hold Reason), you can select one of "is equal to" or "is not equal to". 


When using one of the Reference fields, you will have access to the following operators:


Create a Script-Based Rule

Before you can create a Script-Base Rule, a Script of type Order Rule must first be created. Please review Order Rule Scripts for more information on how to create the script.


1) Click on Settings, Configurations and in Orders sub-menu, click on Rules. 

2) Click on New Order Rule and enter the Rule Name, an optional description, in Type, select Script.

3) Select, in the Script drop-down field, the Order Rule script to be associated to the Rule.

4) Click Save. 


Edit an Order Rule

1) Click on Settings, Configurations and under Order menu, click on Rules. 

2) In the list of Rules, click on the Rule to edit.

3) Make desired modification then click on Save.


Delete an Order Rule

1) Click on Settings, Configurations and under Order menu, click on Rules. 

2) In the list of Rules, click on the Rule to delete.

3) Click on Delete button. 

If the Rule is used in a Notification Template, an error message will display listing the Notification Templates where the Rule is used. 

4) Click OK to confirm deletion, Cancel to return without deleting the Rule.  



Order Rule Scripts

Order Rule scripts can be created to return True or False as a result. 

*Use of the Scripts feature requires subscription to the Developer Toolkit add-on.

 


Create an Order Rule Script

1) Click on Settings then System then click on Scripts.

2) Click on New Script.

3) Enter a required name, optional description and select in Type, Order Rule then click on Create.

4) Write the script in the Content, click on Validate to ensure there are no errors then click on Save.