How to Work with Rules
IN THIS GUIDE
Use the Rule Builder to tell Order Desk how to take action automatically on your orders or items within your orders. If you are unfamiliar with rules, please take a few minutes to read How Customizable is Order Desk Really?
For an explanation of all events, filters and actions, see the Rules Reference guide.
How to Create a Rule
To create a rule, click on Rule Builder under the Settings menu in the left sidebar.
When you first visit this page, follow the prompts to create a new rule, or if you don't see anything on the page, click the New Rule button in the top right corner.
Choose the type of rule you want to create from these options:
- Order Rule: the rule will take action on an entire order.
- Order Item Rule: the rule will take action on certain items within an order.
An event is what happens to an order that can trigger a rule to run. Events include Order is Imported, Shipment is Added and Folder is Moved, to name a few. A list of all events can be found here.
You can also create or select a custom event (an event where you decide the schedule) or a custom button (an event that runs when you click a button) from the Event tab.
Filters determine what a rule should run on. If you want a rule to run on every order, you won't need any filters, but if you need to specify actions for certain orders or items, use filters to tell Order Desk this information.
Multiple filters can be used in a single rule but will need to be set as either AND or OR.
AND tells the rule that all filters must be true, while OR tells the rule that only one of the filters must be true for the rule to run.
AND/OR Example 1
In the above rule, when an order is imported, if the shipping country on the order is FR OR BE, the order will be sent to Amazon FBA France.
However, what if the same rule uses AND instead of OR?
This rule says that when an order is imported, if the shipping country is both FR AND BE, to submit it to FBA France. An order can't have two shipping countries in the address, so this rule will never work.
AND/OR Example 2
In the above example, if the shipping country is FR AND if the order has the SKU 132ML in it, the order will be submitted to FBA France. Both filters have to be true for the rule to send the order to FBA.
However, what if the same rule uses OR instead?
In this case, the order will either need the shipping country to be FR OR a product SKU to be 132ML. If only one of these filters is true, the order will be sent to FBA France.
Actions are what happens when the rule runs and takes action on your orders or order items. Multiple actions can be added to a single rule. For a complete list of actions available and what each means, see the Rules Reference guide:
How to Run an Event
You may need to manually run an event instead of waiting for it to happen.
For example, if you created a rule for the Order is Imported event, but there were already orders that had imported before the rule existed that you need to run the rule on. To force an event to run, click the Run an Event button:
From here, select the event you want to run and your target folder or order, then click Run Event.
Order ID is the order number. Internal ID is the number from the Order Desk URL for the order.
How to Test Rules
To test a rule, first disable the rule by clicking on the toggle on the rule, turning it red. This will prevent the rule from running accidentally while testing.
Next, duplicate that rule by clicking on the duplicate button:
This is so you can test with the copied rule while ensuring the original rule still exists and isn't changed.
On the copied rule, change the event to Order Confirmed.
If you are already using the Order Confirmed event for any other rules, disable those rules before doing any testing on this rule.
Keep the filters the same, but remove all actions from the copied rule. Add a new action to tag the order a color of your choice.
Enable the rule.
Find an order that should be affected by the rule and follow the instructions for how to run an event. Choose the Order Confirmed event and enter the order number as the target.
If the rule successfully ran on the order, the order will have changed to the color you selected. It's a good idea to run the event on a few other orders where the rule shouldn't apply to ensure that it does not take action.
If the rule is working as expected, you can delete the copied rule and enable the original rule.
Rules will run in sequential order based on their location under the trigger event. The order of your rules can be edited by simply dragging and dropping them in the Rule Builder.
Be careful to avoid loops, which are rules where the event and action will loop continuously. For example, a rule that says to create a PDF when a PDF is created will continuously create PDFs, causing your store to slow down considerably.
To protect against an infinite loop, you can only run 100 rule actions on a single order for a single event before the Rule Builder stops running.
If in doubt, contact Order Desk support to review your rules.