getting the field value as marked string (with new line chars)

david_levy March 10, 2024

I'm trying to create a variable that gets the field value as it appears in

https://my jira.atlassian.net/rest/api/2/issue/ikey-180231?expand=names

for example the field :44.PNG

From JIRA the issue appears without the new line chars.

 33.PNG

I tried using the following with no luck {{LW_EscalationData2.replaceall("(\r\n|\r|\n)","\n")}} 

it always retrieves my variable as a single line without the new line char.

 

 

 

1 answer

1 accepted

2 votes
Answer accepted
Bill Sheboy
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.
March 10, 2024

Hi @david_levy 

When you note:

...it always retrieves my variable as a single line without the new line char

How do you know that?

For example, if you are writing that field to the audit log, the newline and carriage return characters will not display.  The log view appears to display them as a single space.

Perhaps if you post your entire rule and audit log details showing the rule execution, those will provide more context.  Thanks!

Kind regards,
Bill

david_levy March 11, 2024

I have a string in a multiline field (as seen above) and I want to send it via webservice.

I found out that I could not send multiline in webservice so I created a new simple text field with the same text and I sent it via the webservice but I got an invalid string error all the time.

When I set explicitly the message with the new line chars in the Jason body, it can send it through.

The automation:Trigger.PNG

Trigger2.PNG

The audit log:auditlog.PNG

 

Bill Sheboy
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.
March 11, 2024

Thanks for that information, David.

Rather than moving the data to another custom field, have you tried using one of the encoding functions on the original multi-line field and then sending that in the message?  That should preserve the characters using the relevant protocol.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#Encoding

david_levy March 12, 2024

Thanks, Bill,

I tried the {{issue.summary.jsonEncode}} and it works as you suggested.

Thanks

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events