JSM Customer Visible Status replication
Introduction and prerequisites
JEMH can replicate the Customer Visible Status by taking advantage of the following existing functionalities:
Customizing Email Templates
Velocity Scripting: Customize Email Templates | Macros
Template Sets: https://thepluginpeople.atlassian.net/wiki/spaces/JEMH/pages/2850840
JSM Customer Notifications: Use JEMH For JSM Notifications | How To Set Up Customer Notifications
Inhibiting Email Notifications: Prevent /inhibit sending of a notification (Issue Event or Postfunction)
We will not go into detail with the aforementioned functionalities. It is recommended that you read the documentation regarding these functionalities before attempting the following sections.
JSM uses the Generic Issue Event for Issue Updates and additionally you may want to review the Issue Comment Event if you require this also reflect the customer visible status functionality.
We suggest that you create these scripts as a Macros for more info on Macros here: Customize Email Templates | Macros
Setting status variables
To able to replicate the Customer Visible Status functionality you will first need to know what the new updated status typically used for the Generic and Updated Issue Events.
Example Script:
#set($oldStatus = "")
#set($newStatus = "")
#if ($!changelog)
#set ($changeList = $changelog.getRelated("ChildChangeItem"))
#foreach($changeListItem in $changeList)
#if($item.getString("field") == "status")
#set($newStatus = $item.getString("newString"))
#set($oldStatus = $item.getString("oldString"))
#end
#end
#end
Other Issue Events
Other issue events will not need to go through the change log you get the current status here
#set($currentStatus = $issue.getStatus().getName())
Prevent/Inhibit status from the customer
These options will inhibit the notification if the Status is updated regardless of any other changes to the Issue for example comments or custom field updates.
You may want to masquerade the status instead or check if the only item in the is the status change see Examples section.
Make sure you review which change-list items are triggered before inhibition. For example if you want to inhibit a Resolved Status there may be more change-list items than expected.
As test show the change-list items during a status change by running in a test notification:
#set ($changeList = $changelog.getRelated("ChildChangeItem"))
#foreach($changeListItem in $changeList)
$changeListItem
#end
Output in test notification email:
Notice there are two change log items with fields: resolution and status. Therefore if you want to inhibit if the only change was a resolved status type you will need to take into consideration the field “resolution”.
If you want to prevent customers from receiving updates to particular statuses then you will need to set an inhibition more information here: Prevent /inhibit sending of a notification (Issue Event or Postfunction).
You will first need to set the name of the status you want inhibited we’re using (In Progress as the example here):
Inhibit if update is the same
Inhibit Status Regardless
Inhibit Current Status
Masquerade a Status as another status
Set a list of Statuses to be treated as another Status.
Masquerade New Status
Afterwards find references to the $status variable in your Template and set the status as $displayStatus as the example the Generic Issue Event Notification:
Examples
This Macro Script does the following (Note this is for Issue events with a changelog e.g. Updated Issue Event or Generic Issue Event):
Masquerade “To Do” and “Waiting for support” as “In Progress”
If the issue was already in progress then inhibit the notification and the only notification was a status update then inhibit the notification.
When the issue first transitions to “In Progress” or changes from “In Progress” to different status not listed in the list
$masqueradeAsInProgress
then continue with notification