You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
I have a Problem with Jira Summary and newline-handling that I need help with:
I would like to automatically populate my summary via Description. For this I used a Skriptrunner behaviour to set my Summary with this code:
After that I am using a Post-Function to create a new Issue out of a Workflow [Create / Clone Issue(s) Post-function].
The argument to set the (New-Issue-)Summary to is the Description of the current Issue. I want it to be copied automatically.
Now I have the problem, that if I use a Description that contains Newline-Characters I get the error that Jira can't handle newlines in Summary's. So I wrote this code to circumvent this (almost the same but here we go):
String newline = System.getProperty("line.separator");
String Description = issue.get("description");
if(issue.get("description").contains(newline)){
Description.replaceAll(newline,"")
if(Description.length()>197){
String CutDesc = Description.substring(0,197) + "..."
return CutDesc
}
}
if(issue.get("description").length()>197){
String CutDesc = Description.substring(0,197) + "..."
return CutDesc
}
else{
return Description
}
Now my Problem is: If I use text in the description, that uses newline characters, i.e. Tables, I get a "Create/Clone Issue Exception: Summary contains newline characters" when trying to create my Issue via Post-Function.
My question now: Is my code not working (because testing it in groovy skript seemed to work)?
or
Is jira checking for newline characters before my code can even get to work?
and
How is it even possible that the summary gets a newline character if jira can't handle it at all?
Thanks for any help or Info
For anyone interested: I found out, that because the description uses a wiki renderer, the correct term to use for is not what you would think it is: system.getproperties("newline") does NOT work. Instead you have to search and replace for "\r\n". Both together.
It's not written down in any documentation on atlassians side I could find so here you go.
To use this, just go:
(in fill summary)
String dsc = issue.get("description")
return dsc.replace("\r\n","")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.