Summary: A business rule tells Shipstore to do something automatically. Each rule has an Event (when it runs), Criteria (when it applies), Actions (what it does), and optional Child Rules (what runs next). This article explains each part and the choices you get in it.

Before you start

You need access to your Business Rules screen. Global rules apply to every shipping profile. Profile rules apply to one profile only. See the related articles below for where each one lives and which wins when both exist.

The four parts of a rule

1. Rule Type and Event: when the rule runs

The Rule Type sets the family of rules and the events you can pick from: Shipping, Packing, Batch, Order, and Trailer rules.

The Event is the moment the rule runs. Shipping rules give you 14 events, paired before and after each stage:

  • Before and After Shipment Loads
  • Before and After Shipment Rates
  • Before and After Shipment Processes
  • Before and After Shipment Voids
  • Before and After Post To Host
  • Before and After Voids From Host
  • Before and After Label Prints

Picking the wrong event is the most common reason a rule seems to do nothing. A rate markup, for example, has to run on a Before Shipment Rates event to change the quote.

2. Criteria: when the rule applies

Criteria decide which shipments the rule touches. A rule with no criteria applies to every shipment for its event. Each criteria line is four choices:

  • Object - what you are testing. There are 18: Shipment, ShipTo, Origin, Return To, Bill To, Return Ship To, Return Origin, Return Return To, Return Bill To, Importer, Exporter, Producer, Package, Intl Commodity, LTL Commodity, Package Item, Pallet, and Carrier Email.
  • Field Name - the field on that object. The list reloads when you change the Object. Shipment has over 170 fields; the address objects have 13 each.
  • Comparer - how to compare. Dropdown fields give you only Is, and Is Not. Text fields give you all ten:
    • Is, and Is Not
    • Contains, and Does Not Contain
    • Starts With, and Does Not Start With
    • Ends With, and Does Not End With
    • Matches Regular Expression, and Does Not Match Regular Expression
  • Value - what to compare against. This is free text, or a dropdown when the field is a dropdown.

A common miss is picking Contains where you need Is on a field that has to match exactly.

3. Actions: what the rule does

When the event happens and the criteria match, the rule runs its actions in order. Action Type gives you four choices.

  • Set Field - change a field. Pick the Object, the Field To Set, a Set Type (Set Field to Value, Append Field Value, Un-Append Field Value, Add to Field Value, Subtract from Field Value, Multiply Field Value, Divide Field Value), and a Value. Values accept tokens such as {ListBaseCharge} and {MarkupBaseCharge}.
  • Prompt User - ask the person for something while they work. Prompt Type is Message, Set Field, or Throw Error, and you write the Prompt Message. A prompt is not display-only: when Prompt Type is Set Field, the action also gives you an Object, a Field To Set, and an optional Regex Format, so what the person types gets saved into that field. If a prompt appears but nothing is saved, Prompt Type is usually still set to Message.
  • Generate Document - produce a document such as a Commercial Invoice, Shippers Export Declaration, Certificate of Origin, NAFTA Certificate of Origin, EOD Summary, Carrier Signature, Straight BOL, TLS BOL, Generic Packslip, or 49CFR Manifest, plus any documents set up for your site. Pick a Generation Type: Prompt, Print, Export To Network Folder, FTP, or Email.
  • Generate Label/Doctab - print a label or doctab using a Label Mapping set up for your site, and a For Each object that says what to print one of.

One thing to know about the Field To Set list: it shows each field's caption, which your site can rename. So the wording you see in that list may not match the stock field name, while the token you use in a Value stays the same.

4. Child Rules: what runs next

Child Rules run after the parent rule's actions finish, and only if the parent's criteria were met. They have their own criteria, and you order them by dragging the handle. Use them to chain steps that depend on each other. Keep the chain short; long chains get hard to follow and slow things down.

What you should see

A rule set up this way runs at its event, skips any shipment its criteria do not match, runs its actions in the order listed, then runs its child rules. If you are not sure a rule fired, check the event first, then the criteria.

If something goes wrong

  • The rule does nothing at all. The event is usually wrong for what you are changing. Move it to the matching Before or After event.
  • The rule fires on shipments it should not. The criteria are too broad, or empty. An empty criteria list applies to every shipment.
  • A prompt appears but nothing is saved. Prompt Type is set to Message. Change it to Set Field and pick the field to write to.
  • Two rules disagree. Rule level decides which wins. See the precedence article below.

Related articles

  • Business Rules
  • Global Business Rule vs. Profile Business Rules
  • How Business Rule precedence works (default, global, profile)
  • Rate markup or rate shop not applied: fix the rule Event
  • Customer Name rule not firing? Use an 'is' match, not regex
  • Switch to a hazmat profile automatically with a child rule
  • How to enter a tracking number for a generic carrier