Skip to content

Automation  ·  Revenue operations

How to automate business rules and routing decisions

The rule for which refunds need finance lives in one person's head, and the process stops whenever they are on leave. Here is how decisions that run without them actually work, the prompts that build them, and what running them demands.

Built with Tray Headless

  1. System Zendesk
  2. Step Read the facts
  3. Step Check the rules table
  4. Step Sort free text with AI
  5. System Salesforce
Also Send unclear cases to a person

Rules decide the clear cases, AI sorts the free text, and anything neither can place goes to a person with the reason attached.

The short answer

What is business rules automation?

Automating a business decision means writing the rules down as a table the process owner can edit, applying them to the facts the workflow has gathered, using AI only to sort what rules can't read, such as a request written as free text, and sending anything that matches no rule to a person. Most decision logic fails because it is hidden. A rule buried in a workflow condition or in someone's memory can't be checked, changed or explained when a customer asks why.

Stage 3 of 7: Decide. Part of Process automation, end to end : every stage, the systems it runs on and the guide that builds it.

What matters here

  • Write the rules as a table, not as conditions inside the workflow. A table can be read, changed and checked.
  • Give the table an owner. The person who answers for the outcome should be able to change the rule.
  • Decide from facts the workflow gathered, not from what the requester typed.
  • Use AI to sort free text into a category, then let the rules decide. Don't let a model make the decision itself.
  • Send anything that matches no rule to a person. A default route hides the cases the rules missed.
  • Record which rule decided each case, so every outcome can be explained.

Who this is for

You own a process in revenue operations, finance or support. The rules for who gets what, and when, live in a spreadsheet, a few workflow conditions and the heads of two senior people.

How it works in practice

What has to happen between the facts being gathered and the case going down the right route.

  1. 1

    The facts are collected in one place

    Amount, customer tier, contract terms, region, history: everything the rules need, read from the systems that hold it.

  2. 2

    Free text is sorted into a category

    An AI step reads the request and names the category and its confidence, so the rules have something to match.

  3. 3

    The rules table is checked in order

    The first rule that matches decides the route: approve automatically, send for approval, or hand to a team.

  4. 4

    Cases no rule matches go to a person

    With the facts and the reason no rule applied, so they can decide and suggest a new rule.

  5. 5

    The decision is recorded with its rule

    Which rule fired, on which facts, so the outcome can be explained later.

What a routing decision is made of

Four pieces, and the first is the one that keeps the others honest.

A rules table with an owner

Each row says when it applies and what happens. The process owner edits it, and every change is logged with who made it.

Facts, not claims

Rules run on values read from systems of record. A customer tier from the CRM beats a tier typed into a form.

AI that sorts, rules that decide

A model turns free text into a category with a confidence score. Below the threshold, the case goes to a person instead of guessing.

A fallback to a person

No match means a human decides, never a quiet default. Each fallback case is a candidate for a new rule.

The Tray Headless prompts

Paste these into Claude Code or Codex with the Tray Headless plugin installed. Each stage runs on its own. The systems named in them are the worked example rather than a requirement, and every prompt says so.

Once per project, run /tray-workflows:set-workspace to pick the workspace these build in. Point it at a sandbox first.

  1. 1

    Write the rules as a table

    A rule nobody can read is a rule nobody can change.

    Headless skills build-workflow

    Use build-workflow. The systems in play are Zendesk, Salesforce,
    Stripe and Google Sheets, or whatever we run in those seats.
    
    Build a rules table with one row per rule: the conditions (amount
    band, customer tier, request category, region), the route (approve
    automatically, send for approval, hand to a team) and a priority.
    Keep it in a sheet the process owner can edit, and log every change
    with who made it and when.
    
    Rules are checked in priority order and the first match wins. Two
    rules that both match at the same priority is an error to report,
    not a tie to break at random.
  2. 2

    Gather the facts before deciding

    Rules are only as good as the values they run on.

    Headless skills build-workflow tray-patterns

    Use build-workflow. Before checking the rules, read every value they
    need from the system that holds it: the customer tier and contract
    from Salesforce, the payment from Stripe, the request from Zendesk.
    
    If a value a rule needs is missing, don't treat it as zero or as
    false. Send the case to a person and say which value was missing.
  3. 3

    Sort free text with AI, then let the rules decide

    A model is good at reading and bad at being accountable.

    Add an AI step that reads the request text and returns one category
    from a fixed list, with a confidence score and a one-line reason.
    
    Above the threshold, pass the category to the rules table like any
    other fact. Below it, send the case to a person with the model's
    guess shown as a suggestion.
    
    The model never picks the route itself. It answers "what is this
    about?", and the rules answer "what happens next?".
  4. 4

    Send unmatched cases to a person

    A default route hides the cases the rules missed.

    Headless skills tray-gotchas

    Use tray-gotchas. When no rule matches, post the case in the process
    owner's Slack channel with the facts, the category and why no rule
    applied. Let them pick the route in the message.
    
    Record each of these cases. If the same kind keeps arriving, that is
    a rule the table is missing.
  5. 5

    Record which rule decided

    Every outcome should be explainable in one sentence.

    Write the decision to the source record and to Snowflake: the rule
    that matched, the facts it matched on, the category and its
    confidence, and the route taken. Report each week on how often each
    rule fires, how many cases fell through to a person, and which rules
    never fire at all.
  6. 6

    Validate it, then hand the table to the owner

    Because the rules change more often than the workflow should.

    Run the per-step checks and the whole-workflow audit before this goes
    live. Test a case for every rule, a case that matches two rules, one
    with a missing value, one with free text the model is unsure about,
    and one that matches nothing.
    
    Then open the same workflow in Tray Build so the process owner can
    change the rules, the categories and the threshold in the visual
    canvas without a deployment.

What it connects to

Facts come from the systems that hold them, the rules live where the owner can edit them, and the decision goes back to the record.

Zendesk

Supply the request and its text, and receive the route the case was given.

Reads and writes

Salesforce

Supply the customer tier, contract terms and account owner the rules run on.

Reads

Stripe

Supply payment amounts and history for rules that depend on them.

Reads

Google Sheets

Hold the rules table the process owner edits.

Reads

Slack

Put unmatched cases in front of the process owner, with the facts and a way to choose the route.

Reads and writes

Snowflake

Hold every decision with the rule that made it, which is where missing rules show up.

Writes

Same build, other stacks

The design does not change if you run something else in one of these seats. The same prompts build it against Microsoft Dynamics 365, Google BigQuery, Microsoft Teams, Jira, HubSpot or Databricks.

Connections in this build

Field mapping, templates and common problems for each pairing: Salesforce + Zendesk, Stripe + Salesforce, Google Sheets + Salesforce and Google Sheets + Stripe.

Named systems are the ones most teams run, not the only ones that work. Each is an authentication in your Tray workspace, referenced by name, so the workflow never holds a credential. Where we have a connector page, the name links to it.

Running it in production

The rules are the control, so they have to be visible and owned.

It runs on the platform, not on your laptop

Decisions happen whenever a request arrives, and the rules table is read fresh on every run.

Every rule change is logged

Who changed which row and when, so the rules in force on any date can be shown.

Credentials are managed, never in code

Read access to the systems that supply facts, and write access only to the fields the decision updates.

AI never decides alone

It sorts text into a category. The rules decide, and anything uncertain goes to a person.

The owner changes the rules

In the table and in Tray Build, without a deployment or a ticket to engineering.

Questions people ask

Why a table instead of workflow conditions?

Because a table can be read, changed and checked by the person who owns the outcome. Conditions inside a workflow can only be changed by whoever built it.

Should AI make the decision?

No. AI reads free text and says what it is about. The rules decide what happens, so every outcome can be explained by pointing at a row.

What happens when no rule matches?

The case goes to a person with the facts and the reason no rule applied. Each one is a hint about a rule the table is missing.

How is this different from approval routing?

This decides the route a case takes. Approval routing handles the cases whose route is a person's sign-off: who approves, how they are asked and what happens at the deadline.

Which metric matters most?

How many cases fall through to a person each week, by kind. Falling numbers mean the table is learning; a steady stream of one kind is a missing rule.

Last reviewed October 2026.