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

How to append a new line to a multi line text field

vincenzo.spatafora
Contributor
October 18, 2024

Dear ALL,

I would like to implement an automation rule in order to append the last comment of an issue to the multi line text field of this issue without overwriting the existing lines.

My syntax is:

{ "update": { "customfield_27200": [{"set":"{{issue.comments.last.body}}"}] } }

but it doesn't work.

I have also tried with "set" (instead of "add") and it doesn't work either.

Can you please let me know?

I use Jira DC version 9.12.12.

Thanks in advance, Vincenzo.

1 answer

1 accepted

1 vote
Answer accepted
Marc - Devoteam
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.
October 18, 2024

HI @vincenzo.spatafora 

In you automation rule, select the field where the comment needs to be added.

place first the smart value {{issue.,name of the custom field}}

Then add extra line (enter), twice.

On the second new line set the smart value {{issue.comments.last.body}}

vincenzo.spatafora
Contributor
October 18, 2024

Thanks @Marc - Devoteam.

Not sure I fully understand.

Do you mean from "Edit issue" to select my multi line text field and then to add {{issue.comments.last.body}} as for below:

Multi-line-text-field.PNG

Cheers, Vincenzo. 

Marc - Devoteam
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.
October 18, 2024

Hi @vincenzo.spatafora 

Yes the Edit action and select the multiline field

But add :

{{issue.For Information}} or {{issue.customfield_27200}}

{{issue.comments.last.body}}

The first smart value is to retina the original content.

Check which smart value you need to retain the original field value the name or custom field ID

vincenzo.spatafora
Contributor
October 18, 2024

Hi @Marc - Devoteam,

tried out both cases and it didn't work for me.

I have logged the value of either 

{{issue.For Information}} and  {{issue.customfield_27200}}

and the log is empty actually.

Thanks, Vincenzo. 

 

Marc - Devoteam
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.
October 21, 2024

HI @vincenzo.spatafora 

Then crate a variable first based on the custom field and then the edit.

Then use the variable instead of the 

{{issue.For Information}} or {{issue.customfield_27200}}
vincenzo.spatafora
Contributor
October 21, 2024

Hi @Marc - Devoteam,

thank You very much, now it works.

What about clearing up a specific line from the mutli-line text field?

Is this possible? I would like to clear a specific line up and NOT all the lines from the field.

Thanks, Vincenzo. 

Like • Marc - Devoteam likes this
Marc - Devoteam
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.
October 21, 2024

Hi @vincenzo.spatafora 

That would be tricky, as searching for text is fuzzy in Jira. 

I would not do this in any case

Log all information (text) from the field and then edit the text field using an array so smart values.

Check:

The Replace or ReplaceAll functions:

Smartvaluestextfields-replace-Stringtarget-Stringreplacement 

Smartvaluestextfields-replaceAll-Stringregex-Stringreplacement 

But still if the text is not consistent the smart value clause would cause issues as they cloud remove or replace text you don't want to remove or changed

Like • vincenzo.spatafora likes this

Suggest an answer

Log in or Sign up to answer