Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Has anyone had any experience with removing the body message of emails for newly created tickets?

Saleem T October 4, 2017

'm trying to figure out if it's possible to remove the body of the message that's sent when an email is sent after a Service Desk ticket has been created.
I've updated the customer notifications to no longer include the message when a comment is made or edited, however, newly created tickets contain the body of the message.
Is there any way to adjust this to include a pre-defined message without adjusting the template file on the physical server itself?

I’ve already configured the service desk notification setting for each project to not include the comment.
To my understanding, the strip away old data route only works for replies. It won’t manipulate the body of a new message.

2 answers

1 accepted

3 votes
Answer accepted
Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2018

Hi Saleem,

 

The contents of the notification email can be customized, but the associated files differ from the current documentation.  I'm able receive notifications on issue created events that only contained a custom message with some modifications with one caveat.  The changes were global. Any project that fires an issue created email followed the same template.  I'm sure the template could be modified with an if statement that removes the fields only if a specific project key is found, but I lack the knowledge of the templating language to accomplish this.  I'll include the steps I took to achieve the global template in hopes that it nudges you in the right direction.

 

1. Create a new template file custommessage.vm in the following folder:

<jira_install>atlassian-jira/WEB-INF/classes/templates/email/html/includes/fields

#disable_html_escaping()
<tr>
<th>Custom Message:</th>
<td>This is the custom message that users will receive in the body of the email.</td>
</tr>

 

2. Create a copy of <jira_install>/atlassian-jira/WEB-INF/classes/templates/email/html/issuecreated.vm so that you can revert any changes.

3. Edit the issuecreated.vm file.

4. Delete the contents of <table class="keyvalue-table">

5. Add the custom template you created. The table should then look like:

<table class="keyvalue-table">
#parse("templates/email/html/includes/fields/custommessage.vm"
</table>

6. Remove the description field from the template. The following text should be removed:

#if ($issue.description)
#set($textParagraph = $issue.htmlDescription)
#rowWrapperNormal("#parse('templates/email/html/includes/patterns/text-paragraph.vm')", '', 'issue-description-container')
#end

7. Restart JIRA and create an issue that triggers an email to confirm the customization worked.

John Kim April 10, 2018

Hey Shaun,

Thanks for these details.

If I wanted to update the issuecommented template, what are your thoughts on what to adjust? the template looks a bit different compared to the issuecreated one.

I'm working on pushing the issuecreated changes out to production, and would like to expand this functionality.

Thanks,

-Saleem

Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 11, 2018

What specifically are you wanting the issuecommented email to include? This should help determine what needs to be pulled from the template.

Saleem T April 11, 2018

Hey Shaun, (sorry i responded on the wrong acc beore)

I was hoping to follow a similar outcome with the issuecreated template.

Ideally, I'd like to replace the body of any template that sends the body of a message. Once I understand how to update issuecommented, I should be able to update the resolved, reopened, and other templates that include a body message.

Btw, the documentation you provided worked very well! newly created tickets have a custom message template now!

Thanks,

-Saleem

Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 11, 2018

I'm glad the instructions I provided have been been useful!  Here's how I modified the issuecommented.vm to get just the custom text.

 

#disable_html_escaping()

#defaultMailHeader("email.event.activity.commented.issue", $changelogauthorLink)



#set ($commentActionBody="#parse('templates/email/html/includes/fields/custom-comment-message.vm')")
#rowWrapperNormal($commentActionBody)

###set($extraFooterContent = "#parse('templates/email/html/includes/set-issue-details-context.vm')")

#parse("templates/email/html/includes/footer.vm")

Create a file that you'll put your custom comment text in, in the example I use custom-comment-text.vm . The contents of that file for example could be:

#disable_html_escaping()
<p>This is the custom message that users will receive in the body of the email.</p>

 

Hope that helps! 

Like Chris Terry likes this
Saleem T May 2, 2018

Sorry for my delayed response on this Shaun, i've been out for the past couple of weeks. 

I plan to implement these changes into our jira server today and will update the ticket after.

John Kim May 8, 2018

Hey Shaun,

I have one last follow up question on this topic.

Do you have any examples or recommendations on how to approach adding logic to these notifications? There is an internal concern regarding this change and how it impacts Jira users. If possible, I would love for only Service Desk projects to use the new notification changes.  

The way it's currently set, all Service Desk agents AND Jira users receive the new notification changes. Thoughts on how to specify or add logic for projects?

Thanks,

-Saleem

Saleem T May 8, 2018

Sorry I keep responding from the incorrect account.

The below response is from me (Saleem):

Hey Shaun,

I have one last follow up question on this topic.

Do you have any examples or recommendations on how to approach adding logic to these notifications? There is an internal concern regarding this change and how it impacts Jira users. If possible, I would love for only Service Desk projects to use the new notification changes.  

The way it's currently set, all Service Desk agents AND Jira users receive the new notification changes. Thoughts on how to specify or add logic for projects?

Thanks,

-Saleem

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 26, 2018

Jira Service Desk has had the ability to customize notifications in the UI since at least 3.3.0 in the Server line.  I know that the Cloud version also has this ability.  More details in https://confluence.atlassian.com/servicedeskcloud/blog/2016/09/customize-the-notifications-you-send-to-your-customers

Have you tried to customize the notifications on the Request Created trigger?  Perhaps that would help.   Or is it that this method to customize this is insufficient in some way?

Saleem T March 26, 2018
Hey Andrew,Thanks for your response. Maybe I should clarify a bit more behind the request, I've configured the service desk notifications to include a custom body message which works with customers.The issue I'm having is service desk agents are receiving the jira email template, and not the service desk one. There are velocity templates that can be manually updated, but I'm struggling to figure out what piece ties to what in the message. I've played around with the velocity templates so far, and after three attempts I haven't found a way to manipulate the body of the message using said templates.
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2018

Ah, well in that case, Agents are not expected to get the same kind of notification that customers get.  There is a deeper explanation of this in JIRA Service Desk Notification explanation

Basically users in the Agent role will still get Jira Core notifications.  As such I hope that our documentation in Customizing email content would be helpful here.  However I am cautious of this, as I believe this document was created for older versions of Jira.  As such it is possible that our current documentation on this might be out of date for more current Jira versions.

Have you tried to follow that guide?   I would be interested to learn which specific files you might have altered here and in what way to see if perhaps we can learn more about this to better understand the problem here.

Andy

John Kim March 28, 2018

Hi Andy

Thanks a lot for the service desk notification explanation. I had a general idea that the notifications worked this way after some trial and error, but its good to see documentation on how things are actually expected to work.

Ah yes, the infamous customizing email content page. I'm more than familiar with that page and at this point I feel it doesn't provide a solution to my issue. I would deduce from my velocity template tests that this documentation doesn't serve the same purpose for new jira instances as it did for older ones. 

I've used the guide for a couple of tests when I updated the velocity templates, but ultimately I abandoned it once I quickly learned it doesn't define the exact variables or pieces that I need to update. I ended up just running tests where I went in and manipulated 5-10 different templates just to try and understand what is going on. No test adjusted the body of the message. I managed to update the subject, the atlassian tag at the bottom of the message, and even the html that builds out the notification. However, I could not find any place to successfully inject a plain text message. My message was either ignored, or thrown into the subject of the notification.

At this point, I've started to loop in additional members on my side to brainstorm another solution as opposed to turning off notifications entirely.

Our thoughts would be to create a postfix server that jira would relay its messages through. This server would also replace the body of the message with a default plain text message. 

Given the documentation you provided, I feel the postfix route could work!

Thanks,

-Saleem

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events