Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira scriptrunner email template not adding line breaks.

Shawn Mahoney April 1, 2019

How can you add a new line within this example?  Regardless of how I do this, the email is sent with everything on the same line.

def fields = get('/rest/api/2/field')
.asObject(List)
.body as List<Map>

def customFieldId = fields.find { it.name == 'TextFieldB' }.id as String
def customFieldValue = (issue.fields[customFieldId] as Map)?.value

"""Dear ${issue.fields.assignee?.displayName},

The ${issue.fields.issuetype.name} ${issue.key} with priority ${issue.fields.priority?.name} has been assigned to you.

Description: ${issue.fields.description}

Custom field value: ${customFieldValue}

Regards,
${issue.fields.reporter?.displayName}"""

1 answer

1 accepted

0 votes
Answer accepted
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2019

Perhaps you have Email format set to HTML, in which case you need <br> or <p> tags to cause linefeeds, e.g.

<p>Dear ${issue.fields.assignee?.displayName},</p>

<p>The ${issue.fields.issuetype.name} ${issue.key} with priority ${issue.fields.priority?.name} has been assigned to you.</p>

Either do that or switch from HTML mode to Plain Text mode.

Shawn Mahoney April 1, 2019

Thanks,  I figured this might have something to do with it, but the script console made it look like the tags would be included as literal strings in the return.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events