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

How to remove multiple lines of text from the issue description using Automation for Jira?

Shah Baloch July 17, 2023

Hi Community,

I'm using "Automation for Jira" to update an issue by removing the first line of text from the issue description. I added JQL when it matches it runs and edit the issue. It is working fine.

Now I'm trying to modify the job to remove the last line of text from the issue description as well and added both pieces of code to update the Action (description) but it's removing the entire issue description when it edits the issue. I tried to add both lines of text in the same code and separated using a comma, still didn't work. This is how issue description looks like an issue is created:

This is the first line.

there

are

more

than

twenty

lines

in

the

issue

description

This is the last line.

 

{{issue.description.remove("This is the first line that should be remove from the issue.")}}

{{issue.description.remove("This is the last line that should be remove from the issue.")}}

Is this possible to remove the first and last line of the text from an issue?

Thank you,

2 answers

1 accepted

1 vote
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.
July 17, 2023

Hi @Shah Baloch 

Are the first and last lines static text?  If so, you can remove both with a single expression, eliminating the need for two edit actions and the re-fetch, like this:

{{issue.description.remove("This is the first line that should be removed from the issue.").remove("This is the last line that should be removed from the issue.")}}

Kind regards,
Bill

Shah Baloch July 17, 2023

It worked, thank you so much @Bill Sheboy 

Like Bill Sheboy likes this
0 votes
Arkadiusz Inglot
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.
July 17, 2023

For me it is working that way:


testautomation.png

 

1. Edit description {{issue.description.remove("This is the first line.")}}
2. Refetch data
3. Edit description once again {{issue.description.remove("This is the last line.")}}

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

Shah Baloch July 17, 2023

Hi, @Arkadiusz Inglot thank you for your response. Earlier I mentioned it's removing the description. I'm not sure why I earlier said it's removing the description. I might mix it up with something else. Actually, it's not removing the entire description, instead, it's duplicating the description if I add the smart value code twice in the description. I also tried to follow your screenshot. I added an action (desc) and added one smart value to remove the first line, then added re-fetch issue data, and after that added another action (description) and added a smart value for the last line.

When it runs it removes the first line from the description but it won't remove the last line then it adds the entire description below and second part it removes the last line. Here is an example of what it does when it runs.:

there

are

more

than

twenty

lines

in

the

issue

description

This is the last line.

This is the first line.

there

are

more

than

twenty

lines

in

the

issue

description

Thank you,

automation-7172023.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events