How do triggers run according to their position on the trigger page?
Triggers continue to execute until none of the trigger conditions are met. This means that Zendesk Support may run through the list of triggers several times until no more tickets meet the trigger conditions.
Thus, it's important to understand exactly how triggers are executed.
How do triggers execute?
Triggers run each time a ticket is created or updated. The trigger execution can be broken down into the below stages.
- The first trigger of the triggers page is evaluated. The ticket is checked against the conditions specified for the trigger. If the ticket satisfies those conditions, the trigger will update the ticket according to the actions defined in the trigger.
- Support moves on to the next trigger in the list of triggers and repeats the evaluation step.
- This process continues until the end of the list of triggers is reached. At that point, Support returns to the top of the list of triggers and begins evaluating each trigger again to see if the ticket now meets the conditions. Previously fired triggers shouldn’t fire again, but if a trigger is suddenly made true by a prior trigger (even one that ran on a previous loop through the list of triggers) then that trigger will fire.
- Triggers stop executing on that ticket when this ticket fails to satisfy any new trigger conditions.
Why does it matter?
Admins sometimes use the order of the triggers as a way of creating triggers with imprecise or incomplete conditions. They will place a trigger earlier in the trigger order thinking it won’t fire because the conditions weren’t met on the initial iteration of trigger execution. Unfortunately, that’s incorrect and the trigger will fire on a subsequent iteration if the trigger conditions are suddenly fulfilled due to the action performed by a later trigger.
It’s important to create trigger conditions that are as specific as possible, taking into account all triggers present in the account. This is beneficial because:
- It narrows down the search criteria.
- It returns fewer tickets.
- Fewer tickets to act on means the trigger run will be faster and more efficient.
- Fewer chances of overlapping conditions.
For more information, see the article: About triggers and how they work.