Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction and Prequisites

JEMH can replicate the Customer Visible Status by taking advantage of the following existing functionalities:

We will not go into detail with the aforementioned functionalities and it suggested 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: https://thepluginpeople.atlassian.net/wiki/spaces/JEMH/pages/2850876/Customize+Email+Templates#Macros

Setting the Status Variables

To able to replicate the Customer Visible Status functionality you will first need to know what the new updated status.

Example Script:

Code Block
#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

Code Block
#set($currentStatus = $issue.getStatus().getName())

Prevent/Inhibit status from the customer

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):

Code Block
#set($inhibitThisStatus = "In Progress")

Inhibit Old Status to New Status if the same

Code Block
#if($newStatus == $inhibitThisStatus)
  #if($oldStatus == $newStatus)
    $jemhUtils.setInhibitSending(true)
    $jemhUtils.setInhibitSendingReason("Status Notification is inhibited") 
  #end 
#end

Inhibit Status Regardless

Code Block
#if($newStatus == $inhibitThisStatus)
  $jemhUtils.setInhibitSending(true)
  $jemhUtils.setInhibitSendingReason("Status Notification is inhibited") 
#end

Inhibit Current Status

Code Block
#if($currentStatus == $inhibitThisStatus)
  $jemhUtils.setInhibitSending(true)
  $jemhUtils.setInhibitSendingReason("Status Notification is inhibited") 
#end

Masquerade a Status as another status

Set a list of Statuses to be treated as another Status

Masquerade New Status

Code Block
#set($displayStatus = "")
#set($masqueradeAsInProgress = ["Todo", "In Progress"])

#if($masqueradeAsInProgress.contains($newStatus))
  #set($displayStatus = "In Progress")
#end

Then you will need to find references to the $status variable in your Template and replace it as the example for example in the Generic Issue Event Notification:

Code Block
#if($assignee != false)
  #if($status != false)
      #if($displayStatus != "")
        $status = $displayStatus  
      #end
      <p> $!assignee changed the status to $!status </p>
      #set($needsBreakLine = true)
  #end
#end

Examples

This Macro Script does this 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

  • 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

Code Block
#macro(customerVisibleStatus $displayStatus)
  #set($displayStatus = "")
  #set($oldStatus = "")
  #set($newStatus = "")
  #set($masqueradeAsInProgress = ["Todo", "Waiting for support"])
   
  #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
    
    #if ($masqueradeAsInProgress.contains($newStatus)) 
      #if($masqueradeAsInProgress.contains($oldStatus))
        $jemhUtils.setInhibitSending(true)
      #else
        #set($displayStatus = "In Progress")
    #end
  #end
#end