|
This article is regarding the |
Based on the state of an approval, you can perform actions on a ticket or fire off actions to take place elsewhere.
A few examples of what you might want to do with this functionality are:
- Automatically mark a ticket as solved once an approval has been granted.
- Fire off another approval after the initial one is granted.
- Send a notification to your company Slack channel or other 3rd party systems.
There are 4 states that you can take action on:
1. When ALL of the approvals on a ticket have been granted.
2. When an individual template has been requested.
3. When an individual template has been rejected.
4. When an individual template has been granted.
The 1st approval state (and perhaps the most important) is the "Approval Granted Date". This date is only set once ALL approval templates that apply to a ticket have been granted.
The approval granted date exists as a Zendesk ticket field called "Approval granted date" which is automatically created the moment you installed the app.
Note: This field should never be added to a ticket form. It should exist outside the access of agents so that only the app is able to update the field.
Note: If you have multiple approvals that will take place in sequence, in order to make sure that the approval date will not be added to the ticket until the last approval is granted, all but the last approval template should have this checkbox ticked in the settings.
You can perform an action on a ticket once the approval granted date has been set using Zendesk triggers.
For this example, we'll set the ticket status to "Solved" when the approval date is set.
To do this, first, create a Zendesk trigger by clicking on the cog on the left of the screen, then in Triggers at the top right click on 'add trigger' like this:
Then under "Meet ALL of the following conditions" add the rules:
Ticket - Is - Updated
Approval granted date - Present
Ticket Status - Less than - Solved
like this:
Note that depending on what you're wanting your trigger to do, you should include a nullifying condition that stops it from looping everytime the ticket is updated. For this example, we're checking that the ticket is not solved before setting it to solved.
Finally in the actions section, set what you want to happen on the ticket.
Above we're simply setting the ticket to a solved status, but you can do anything you want. For example, you may want to send an email to a particular agent or group, or even notify third-party software using Zendesk extensions.
Side note: Another thing you can do with the approval granted date, is that since it's recorded as a date inside a Zendesk ticket field, you could build reports over in insights to show you how many tickets have been approved broken down by approval date.
As mentioned there are 4 points of an approval that you can tap into. 3 of them apply to the state of individual approval templates. These are:
Requested - The request email has been sent to an approver.
Rejected - The approver has declined the approval request.
Granted - The approver has granted the request.
The way to do stuff based on these states is by defining a tag that gets added to the ticket at that point.
In this example, we'll fire off a secondary approval template as a result of the initial one being granted.
To do this simply click on the approvals icon in the main bar on the left. Then under the approvals template tab, click into the desired template like this:
Once you're in the template, at the bottom right you will find the tags section like this:
You'll notice there are two different sets of tags based on the state of the approval. The key difference between them is that only one of the three State tags can exist on a ticket at any given time. These are great for creating views or reports based on the live status of your approvals. On the other side, Event tags will remain on the ticket indefinitely until removed and are ideal for performing actions based on when a specific approval state is reached.
You only need to define a tag for the state you want to take action on. Since in this example all we want to do is send off a second approval once this one is granted, we only need to set a granted tag. As you can see this is set to "manager_approved".
Now, to do something based on this tag we need to create a trigger.
As discussed earlier in this article, to create a Zendesk trigger click the cog on the left of the screen, then in Triggers at the top right click on 'add trigger' like this:
Now in the trigger, set the rules under "meet ALL of the following conditions" to:
Ticket - Is - Updated
Tags - Contains at least one of the following - "manager_approved"
like this:
Finally under "Actions" add the rules,
Remove tags - manager_approved
Notify target - (Name of the secondary approval you want to sent)
like this:
A couple of things to note here: We remove the manager_approved tag to ensure that this trigger only fires once at the point the approval of the first template is granted.
The second thing to note is that in order for the secondary approval template to appear in your list of targets, you will need to go into it and turn on automatic approvals. For more information on building sequential and/or parallel approval sequences see this article.