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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,463,706
Community Members
 
Community Events
176
Community Groups

Automation rule encountered newline and failed

Is there a way to copy a field (i.e. the Summary) during a rule to create a new issue WITHOUT encountering this error:

 

The summary is invalid because it contains newline characters. (summary)

2 answers

1 accepted

0 votes
Answer accepted
John Funk Community Leader Apr 06, 2021

Hi Paula,

Yes, you should be able to do that. What exactly are you trying to do? Or can you share the rule that you have so far? 

The rule creates a related issue and sets the summary and description by copying from the parent issue and, for the summary, appends:

{{issue.summary}} Access [Security KnowBe4+Git+AWS] 

I need to strip the newline from the Summary before it is copied to avoid the error.

Hi @Paula Manildi 

I wonder how the newline got on your summary.  Doing this should remove it:

{{issue.summary.trim()}}

Best regards,

Bill

I will try this [what if the last character ISN'T a newline - will a trim work just to remove unseen character or space but not a real character?] Thanks!

I believe trim() removes any whitespace characters at the start or end of the field:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-text-fields/#Smartvalues-textfields-trim()

Like John Funk likes this
John Funk Community Leader Apr 06, 2021

Also, are you wanting to copy the Summary over from the initial ticket? If so, then it would look like:

{{triggerissue.summary}} Access [Security KnowBe4+Git+AWS]

Copy Description from Current issue seems to be working fine.

Like # people like this

Configuration change is working - since I am not going to try to put a newline in an issue I just have to monitor. The original issue probably came from a cut and paste.

Like John Funk likes this

I have a solution for this: use {{issue.summary.replaceAll("\n", "")}} to remove all newline characters ("\n") instead of {{issue.summary}}.

Hi, 

i've tried your method {{issue.summary.replaceAll("\n", "")}} , but in one case i got an issue on " is invalid because it contains newline characters"

on "lorem p\n ipsum" input text (p\n is aka Part number)

May be you have any insights and ideas? 

Hi @kon

Can you clarify your case further? are you cloning an issue and the content "lorem p\n ipsum" is from the summary of the source issue?

Hi, Phong, 

actually my rule is for description field (but i think idea is same as with summary)

i am copying part of description to summary and want copy without line breaks (otherwise summary will not take it)

{
"fields": {
"summary": "{{issue.description.abbreviate(254).replaceAll("\n", " ")}}"
 }
}

in most cases it works well, except of when user entered p\n to description "lorem p\n ipsum"

Hi @Konstantin Gagac 

What are you expecting the outcome to be for that replacement?

When you use "\n" in the replaceAll() and other functions, it represents the newline character, and not the literal value.

Kind regards,
Bill

Hi @Konstantin Gagac
The previous function that I mentioned works fine via the Inteliji IDE (Java JDK 8) but somehow doesn't work with Jira:

image.png

Anyway, I retested in the Jira Automation and found this correct one:


{{Description.replace("\\n", "")}}

(Note: Kindly notice that it should be "\\n" with double "\\")

 

Test result:

Screen Shot 2022-10-01 at 12.22.14.png


Like Konstantin Gagac likes this

Hi, 

Thankx, i checked your suggestion anf yes it works with replace, but not with replaceAll

i will test with replace for longer time

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events