The Myndbend™ Process Manager action remove-approvers-by-id is used to automatically remove approvers from tickets, using their Zendesk user ID, when certain conditions are met. For example, the initial requester decides to close the ticket because it was submitted by a mistake, and you want to remove all of the approvers that were added in order to save their time from reviewing a request.
How do I use this action?
Create a Zendesk trigger with conditions that match the moment when you want to remove the approver.
Then set the action in MPM. For the action, select Notify Webhook - MPM Webhook. You will be presented the option to paste in the message that will be sent to our servers.
The message for this action is:
{
"action": "remove-approvers-by-id",
"data": ...
}
Where can I find the IDs of the users I want to remove?
Once you've identified the approvers that you want to be removed automatically, you can obtain their Zendesk IDs via these steps:
- Navigate to Zendesk Settings > People
- Search for the approver and click on the user's name.
- Copy the Zendesk ID from the URL. For example:
https://yourdomain.zendesk.com/agent/users/123456789/requested_tickets
How do I specify the IDs of users I want to remove?
Action remove-approvers-by-id has two options you can use.
Removing approvers using their IDs in an array of numbers:
{
"action": "remove-approvers-by-id",
"data": {
"id": [123,321,4524]
}
}
Removing approvers using comma-separated string:
{
"action": "remove-approvers-by-id",
"data": {
"id": "123,321,4534"
}
}
Both of these options will do the same action: Remove users with the following IDs (e.g. "123,321 and 4534") as approvers.
Conditionally removing approvers based on form data
You may need to remove approvers conditionally based on what data is present in the ticket form itself, or based on a ticket's status. For example, "Remove all approvers if the ticket is solved". 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...
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!
Using Liquid Script, you can write simple conditional statements such as:
{% if ticket.ticket_field_123 == 'laptop' %}
321,
{% endif %}
With this statement: If the value of our ticket.ticket_field_123 is a laptop the script will print 321 - Otherwise, it will be skipped completely.
This means we can write our conditional statements (as well as more complex scripts) that will determine the final list of approvers that need to be removed, by including these scripts into our webhook message bodies, like so:
{
"action": "remove-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 %}
"
}
}
The outlined script above is just an example. Be sure to replace field IDs, values, and user IDs with values you need.
In the above code block, you will notice trailing commas after the user ID. This is required if there will be more than one approver added to the string of approvers.
If you decide to use Liquid Script, be sure to read our quick Liquid guide, which covers some of the most common questions.