It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Forcing a Linebreak "\\" --- Issue Comment --- Groovy

JamesR Nov 19, 2012

JIRA Version 4.4.4 Standalone

I have a postfunction groovy script that creates a Comment within an issue.

The Comment field is configured for Wiki Style Rendering.

I'd like to have a forced linebreak within the comment --- via the groovy script.

The \\ character set produces a \ in the wiki renderer --- via the groovy script.

If I use \\\ character set, it produces an error.

Via groovy, is there an easy way to insert a linebreak for use in a comment using Wiki Style Rendering?

Thanks!

3 answers

1 accepted

3 votes
Answer accepted
JamieA Nov 19, 2012

It should be "\\\\". Or use single-quotes then you shouldn't need to escape, ie '\\'.

jamie

JamesR Nov 19, 2012

Thank you, Jamie! Have a good rest of the week.

Vineela Durbha May 03, 2019

Hi @JamieA 

I am trying to add a line break in my comment which is like 

"Open access for ${linkedIssue.getSummary()} branch is extended now until ${dateformat.format(issue.getCustomFieldValue(plannedrcDate))}" . 

How can i insert a new line comment at the end

0 votes
Kramarics György Nov 19, 2012

Hi!

For line break, I usually use this (just for info, if anoyone else looking for this):

String newLine = System.getProperty("line.separator");

Gyuri

JamieA Nov 19, 2012

Fair play, but I don't think that's necessary unless you're planning on write a text file that can be read in windows notepad. Browsers and databases seem to treat \n correctly.

Kramarics György Nov 19, 2012

Somehow /n doesn't worked for me.

JamesR Nov 19, 2012

Dear György, thanks so much for this information.

JamieA Nov 19, 2012

> Somehow /n doesn't worked for me

Should be \n, not /n

0 votes
JiraYO Apr 30, 2019

For me i found the string 

+ '\r\n' + '\r\n' + 

 

works really well to put carriage returns in between my groovy string values, to insert in another work order description or comment using a workflow.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in United States

Topic Tuesday: Agile

Another week, another Topic Tuesday!  Agile has been on my mind a lot lately because I've seen good implementations and bad implementations, but now as a Jira admin it matters more to me whether...

27 views 0 0
View post

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you