The Myndbend Process Manager app supports complex approval workflows in Zendesk. This can be accomplished with a trigger that automatically adds approvers when certain conditions are met from the ticket. For example, in the IT change request - if priority is urgent, it should go straight up to the CTO, while in other cases it goes to the right managers for approval.
When you need to add approvers conditionally, based on what data is present in the ticket form itself, there are two ways to do this:
- Define the conditions of your Zendesk trigger as such. This means that you will have one trigger for each of your possible combinations.
- Use Liquid Script
Pros and cons
Multiple triggers
Pros: It’s simple to create. Using the built-in Zendesk conditions allows you great flexibility, and it is quite simple to build a trigger with a new set of conditions - So, you would just build a trigger that has the conditions matching.
Cons: If your company has a lot of different options and combinations, you might end up with a long list of triggers.
Liquid script
Props: All of the conditions are built in a single trigger, so you have fewer places that you need to update during maintenance.
Cons: It is more complicated to set up, and since all of your child tickets are coming from a single trigger, in case that someone miss configures a trigger during the update, your whole flow could break.
Multiple triggers setup
For each combination of form data that you have, you need to define the conditions of your Zendesk trigger as such. This means that you will have one trigger for each of your possible combinations.
In the action, you will list out the approvers you want to add, using the actions that MPM Webhook supports:
- Adding approval groups
- Adding approvers using their email
- Adding approvers using their ID
- Adding approvers based on a specific tag on their profile
- Adding approvers using the Zendesk Group ID
Liquid script
Liquid Script is a simple scripting language developed by Shopify, used through Zendesk. You can use the liquid script in your tickets, macros, automations as well as trigger messages!
If you haven't already, now is the right time to go through our article about adding approvers automatically since this article is basically an extension of that setup.
Zendesk has a list of placeholders that you can use within the liquid script. Since liquid script provides us with easy-to-use if-then-else statements, we will combine those with Zendesk's placeholders to determine which approvers should be added. We'll do so by checking IF the value of certain form fields is equal to our desired value. If it is, we will send that user ID.
In this example, we will use add-approvers-by-id action.
Based on the type of field used, the code will look different.
If you are using text fields, the code for that will look something like this:
{
"action": "add-approvers-by-id",
"data": {
"id": "
{%- if ticket.ticket_field_option_title_<FIELD_ID> == '<DESIRED_VALUE>' -%}
<USER_ID>,
{%- endif -%}
{%- if ticket.ticket_field_option_title_<FIELD_ID> == '<DESIRED_VALUE>' -%}
<USER_ID>,
{%- endif -%}"
}
}
You can also combine multiple forms in one trigger as well, so you could have a single trigger that adds approvers for all of your forms:
{
"action": "add-approvers-by-id",
"data": {
"id": "
{%- if ticket.ticket_form == '<FORM_NAME>' -%}
<USER_ID>,
{%- if ticket.ticket_field_option_title_<FIELD_ID> == '<DESIRED_VALUE>' -%}
<USER_ID>,
{%- endif -%}
{%- endif -%}
"
}
}