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)
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]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need to strip the newline from the Summary before it is copied to avoid the error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wonder how the newline got on your summary. Doing this should remove it:
{{issue.summary.trim()}}
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe trim() removes any whitespace characters at the start or end of the field:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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]
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have a solution for this: use {{issue.summary.replaceAll("\n", "")}} to remove all newline characters ("\n") instead of {{issue.summary}}.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thankx, i checked your suggestion anf yes it works with replace, but not with replaceAll
i will test with replace for longer time
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.