Scriptrunner: Add line when creating a comment

Nessrine Hafi April 13, 2022

Hello,

I'm trying to create a scripted post function to add a customized comment which gets the last comment and adds it to a string. I succeeded to display colors and bold but when i try to start a new line it's not working. 

I followed this Wiki page and I added // but it's not working.

Is there anyone familiar with this customization ? 

2 answers

2 accepted

1 vote
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 13, 2022

I use \n to create new lines in scripted comments.

Nessrine Hafi April 14, 2022

Hello @Payne ,

Even /n Worked for me so thank you for your answer :) 

Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 14, 2022

Works to and would be my primary usage as well, but tried to stay related to the wiki markup here :) 

As long as it works :p 

1 vote
Answer accepted
Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 13, 2022

Hi @Nessrine Hafi , 

the wiki rendering for a newline is actually 

\\

But If you want it in a string scripted, the \ is used for an escape so the next character is printed literally. 

So a new line in a string for a comment would be like this (twice escaping and twice printing):

final String commentBody = "The \\\\ text for your comment, which can include specific value ..."

Hope this helps! 

- Tessa

Nessrine Hafi April 14, 2022

Hello @Tessa Tuteleers

It was very helpful. I can now start a new line :) thank you and have a nice day

Like Tessa Tuteleers likes this

Suggest an answer

Log in or Sign up to answer