Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,623
Community Members
 
Community Events
168
Community Groups

Script runner "Send Custom Email" sends email with html tags in description field content

Hi All, 

I am trying to send the email using Script runner Send Custom Email option. 

My code is as follows.  I am using "Plain Text" and this sends email with HTML tags. 

Environment: <% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('Environment')).toString()) %>
Description: $issue.description

 

Changing the Description render from JEditor to Default solves the problem. But it is not supporting service desk requests. 

JIRA: 7.3.8

Scriptrunner: 5.0.11

Can somebody help me with this? 

Thank you!

 

1 answer

1 accepted

0 votes
Answer accepted

Hello, 

Could you send an example of what email you receive and a screenshot of the settings you are using on Send Custom Email? Then I'll be able to get more context into what exactly you're doing and what might be going wrong. :)

 

Regards,

Jenna

Hi @Jenna Davis

Settings are as follows

image.png

Preview is as follows. 

image.png

Could you please try changing the Email format from "Plain text" to "HTML"?

I think you might be pulling in html tags from your issue description, changing this setting should let them get interpreted instead of being printed out in the email's body. To check this, you could add a logging statement to see exactly what you're getting when you call '$issue.description". Something like this - 

log.debug(issue.description)

Let me know if this helps!

Regards,

Jenna

Hi @Jenna Davis

Thanks for the suggestion. 

Changing the Email format to HTML and some </br> notations did the job. And didn't want to change description line. 

The following Production SPM has been actioned today. 
</br>
Service Desk ticket: $issue.key
</br>
SPM X-Ref - Test : <% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('SPM X-Refs - Test')).toString()) %>
</br>
SPM X-Ref - Prod : <% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('SPM X-Refs - Prod')).toString()) %>
</br>
Keyed by: <% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('Keyed by')).toString()) %>
</br>
Reviewed by (Peer): <% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('Peer-Reviewer')).toString()) %>
</br>
Reviewed by (client): <% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('Reviewed by Client')).toString()) %>
</br>
To the Global Release Team: The SPM has also been applied to the following environments
</br>
Environment: <% out << (issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('Environment')).toString()) %>
</br>
Description: $issue.description
</br>

Great! Glad that worked for you. 

If you're satisfied with my answer could you please accept it? This helps to let others know how to fix this issue should they encounter it. :)

Also, please do let me know if you have any other questions. 

Jenna 

@Jenna Davis -- I need a favour one of my client is need to see only Active sprint for a task associated in structure. How can i achieve that. We need to see only active sprint task in stucture- this is a 3rd party add-on.

Can you help?

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events