Stop Customer Satisfaction from being added to Reopened issues notifications

Stop Customer Satisfaction from being added to Reopened issues notifications

Scenario

A issue that has previously been reopened is containing the Customer Satisfaction when the issue is being resolved again. This page will describe how to only include the Customer Satisfaction when the issue is closed for the first time.

Implementation

Below is a Custom Macro that overrides therenderCustomerSatisfaction macro and includes a check to see if there is a change log on the issue that states that the status was changed to “Reopened”, if so then the Customer Satisfaction will not be rendered on the notification. For more info about creating Custom macros see: Custom Macros

As this macro uses the renderCustomerSatisfaction name it means that it will take precedence over the default renderCustomerSatisfaction macro and will be used by all default templates.

#macro(renderCustomerSatisfaction) #set($feedback = "true") #foreach ($test in $jemhUtils.getPreviousChangeLogs($context.issue.key.asText())) ##Gathers change logs #set ($items = $test.items) #foreach ($item in $items) #if ($item.field.asText() == "status" && $item.toString.asText() == "Reopened") ##Checks if any change logs contain the Reopened status #set ($feedback = "false") ##If found then this will set Feedback to false #end #end #end #if ($feedback == "true") ##If feedback is true then it means the issue has not been reopened and the Satisfaction will be rendered. #if ( $jemhCustomerSatisfactionManager.shouldShowCustomerSatisfactionQuestion($context)) $jemhUtils.setFieldRendered() <div class="jsd-customer-satisfaction"> <div class="jsd-customer-satisfaction-question"> $messageUtils.getMessage("sd2.email.customer.satisfaction.question") </div> <div class="jsd-srf-line-break"></div> <table class="jsd-srf-star-table-with-text" width="400"> <tbody> <tr> #foreach($i in [$jemhCustomerSatisfactionManager.minRating .. $jemhCustomerSatisfactionManager.maxRating]) <td class="jsd-srf-star-with-text" width="75"> <a href="$jemhCustomerSatisfactionManager.createLink($i)" class="jsd-srf-star" target="_blank">☆</a> <p class="jsd-srf-star-text">$messageUtils.getMessage("sd2.email.customer.satisfaction.$i")</p> </td> #end </tr> </tbody> </table> </div> #end #end #end