Combine workflow trigger conditions with custom logic
Updated
A workflow's CRM trigger can have several conditions. The Match setting decides how they combine: All, Any or Custom. With Custom, you write your own rule, such as (1 AND 2) OR 3.
Before you begin
The workflow must be open for editing. You can't change Match or the logic otherwise.
On the trigger card, select a CRM object with fields. Match appears only after the object's fields load.
Match doesn't appear for a trigger that uses a rule configured in your CRM.
For a Salesforce trigger, a rule that doesn't work like All needs the updated Salesforce trigger connection turned on for your organization. That covers Any with two or more conditions, and Custom logic other than every condition joined by AND. HubSpot triggers don't need it. See Any and Custom on Salesforce triggers.
Choose how conditions combine
On the workflow's trigger card, go to the Trigger rules section.
Add your conditions to the Conditions list.
Next to Match, select one of these:
All: every condition must be true. This is the default.
Any: at least one condition must be true.
Custom: you write the rule using condition numbers.
The text at the top of Trigger rules changes to match. For example, it says a record "that matches every rule starts this workflow" under All.
A trigger without a saved Match setting uses All, so it keeps working the same way unless you change it.
Write custom logic
Set Match to Custom. The conditions in the list are numbered, and a Condition logic box appears under the list.
In Condition logic, enter your rule. Refer to each condition by its number, and combine them with
AND,OR,NOTand parentheses. For example,(1 AND 2) OR 3, or1 AND NOT(2).Check the sentence under the box that starts with Fires when. It describes your rule in plain words.
If the box is empty when you choose Custom, it's filled in with every condition joined by AND, such as 1 AND 2 AND 3. This pre-filled rule works like All: every condition must be true. That's true even if the trigger used Any before, so a trigger that was on Any needs every condition until you edit the rule.
If you switch back to All or Any, what you typed is kept while the trigger card stays open. It comes back when you select Custom again. Under All or Any, only that setting is saved. If the card is closed and reopened before you select Custom again, the logic you typed is gone.
Custom logic only decides how conditions combine. It doesn't change what each condition checks.
Messages in the Condition logic box
Fires when … appears only while the logic can be read. If it can't be read, an error shows instead. After you delete a condition your logic uses, the sentence can still show alongside the error.
If the logic can't be read, the message starts
That condition logic isn't valid.Fix the logic before you publish. An empty box doesn't show this error: it's treated as every condition joined by AND, the same as All.If the logic names a number past the last condition, you'll see a message like
Condition 4 doesn't exist. Your logic refers to condition 4, but this trigger only has 3 conditions. Update the logic, or add the missing condition.If a condition isn't in your logic, a warning says it isn't used and won't affect whether the trigger fires.
You can't publish the workflow while the box shows an error.
Reorder or delete conditions
When you drag a condition to a new place, the numbers in your logic update to match, and the rule stays the same. For example, (1 AND 2) OR 3 becomes (1 AND 3) OR 2 when condition 3 moves to position 2. You'll see Condition numbers updated to match the new order — your rule is unchanged.
When you delete a condition your logic uses, the logic isn't rewritten for you. You'll see a message like Condition 3 was deleted, but your logic still refers to condition 3. Update the logic to match the conditions you have now. Edit the logic to clear it.
If the numbering can't be tracked after a change, a message asks you to check each number against the list before saving.
Any and Custom on Salesforce triggers
A Salesforce trigger needs the updated Salesforce trigger connection when its rule differs from every condition being true. That includes Any with two or more conditions, and Custom logic that isn't every condition joined by AND. A Custom rule that joins every condition with AND, such as the pre-filled one, doesn't need it. Without the connection, a rule that needs it shows a warning on the trigger card, and publishing is rejected. Contact OnRamp support to turn it on, or set Match to All.
The same connection decides whether Salesforce triggers offer empty and not-empty checks. See Check whether a field is empty in workflow conditions.