Out-of-the-box, HelpDesk has a trigger notifying assignees about changes performed by others. Understanding its logic may help to master ticket versions in HelpDesk automation.
The trigger is fired on the Ticket has been changed
event that allows referring to the previous ticket version:
Use LastTicketVersion
instead of Ticket
at the beginning of any reference to get the previous value of a field.
For instance, a reference to a previous ticket title will be such:
[LastTicketVersion.Title]
Here is an overview of trigger’s conditions united into two groups:
The first group defines whether it is a case when an assignee should be notified in general. Each condition of the group should return true. Here, we check whether:
the ticket has an assignee,
the ticket is modified by someone other than the assignee,
the assignee wasn’t changed.
The second group defines changing of which fields the assignee should be notified about. In the second group, any condition should return true. Each expression compares the current and previous states of the following ticket fields:
Title,
Priority,
Due date,
Requester,
Status.
If both groups of expressions return true
, then the notification will be sent.
Here is its sample:
The message body for the Send email action should contain an iteration over Data.FieldChanges which is available only on the Ticket has been changed
event.
It is a system array of objects that contain field values before and after the last modification.
Each one has the following properties to be used as tokens within iteration:
FieldName
,
BeforeValue
,
AfterValue
.
The iteration over Data.FieldChanges
doesn’t require listing of the repeated tokens.
The default trigger renders a table using the mentioned tokens:
<table class="pl-ticket-changes">
<tbody>
<tr>
<th>Field Name</th>
<th>Before</th>
<th>After</th>
</tr>
{{#each Data.FieldChanges}}
<tr>
<td>
{{FieldName}}
</td>
<td>
{{BeforeValue}}
</td>
<td>
{{AfterValue}}
</td>
</tr>
{{/each}}
</tbody>
</table>