Your First Rule

Karl Falconer · Updated

This walkthrough builds, tests, and activates a working rule in about five minutes. You don’t need any programming experience. The example: set the shipping carrier to UPS Ground for every order from a specific store.

Step 1: Open the new-rule wizard

From the Automation > Rules page, click + New Rule. The wizard asks two things: which store the rule applies to, and which hook to attach it to.

The new-rule wizard with hook selection cards

For this example, pick any store and choose Order Import — the hook that fires when an order arrives from a sales channel. Click Continue to editor.

Step 2: Build the rule

The visual editor opens with an empty canvas. A rule is a list of statements. The most common pattern is:

  • WHEN — a condition.
  • THEN — actions that run if the condition is true.

For our example, we want the rule to fire on every order, so we use a WHEN with the condition true. (You could also drop the WHEN entirely and just have the set statements run on every record — both forms work.) Then we set three fields on the order: carrier name, warehouse code, and service level.

The visual editor with a rule that sets three shipping fields

Tip: If you’d rather describe the rule in plain English, click into an empty canvas and use the Generate option. You type something like “Set shipping to UPS Ground for every order”, and DropStream produces a starting rule you can refine.

Step 3: Look at it as code (optional)

Switch to the Code tab to see the same rule in BGL, DropStream’s rule language. The visual editor and the code editor show the same rule — it’s the same data, just two views.

The same rule shown as BGL code

You don’t need to write code to use rules — but reading it is a fast way to understand exactly what a rule does. The example above reads close to English: when true, set order shipping carrier name to “UPS”, and so on.

Step 4: Test it

Click the Test tab. The left side loads sample data and the right side runs your rule against it.

The Test tab with the Test Data and Rule Execution panes

You have three ways to load test data:

  • Search — pick a real recent order from your store.
  • Suggest — DropStream picks a representative order for you.
  • Generate — produces synthetic test data on demand.

Pick an order, click Execute, and the right pane shows what happened — which conditions matched, which fields the rule read, and which fields it wrote. Toggle Trace to see the full step-by-step record.

If something didn’t work the way you expected, the trace tells you exactly why. Adjust the rule and run it again — testing is fast and free.

Step 5: Save and activate

When you’re happy, click Save. New rules start inactive so they can’t affect production traffic by accident. Toggle the rule to Active when you’re ready, and from the next imported order onward it’ll run automatically.

What’s next

  • Browse what rules can do — actions, conditions, loops, and more in the language reference (coming soon).
  • Set up rules for shipments, returns, purchase orders, or invoices — start at Hook Contexts.
  • Manage existing rules — see Managing Rules.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.