How to remove multiple lines of text from the issue description using Automation for Jira?
Asked by Shah Baloch:

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,


Answers:
author: Bill Sheboy
body: Hi [@Shah Baloch](/t5/user/viewprofilepage/user-id/3738782)

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

comments: author: Shah Baloch
body: It worked, thank you so much [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)


author: Arkadiusz Inglot
body: For me it is working that way:

<br />

![testautomation.png](https://community.atlassian.com/t5/image/serverpage/image-id/269379i60A1DEA3C4A0BD56/image-size/large?v=v2&px=999 "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/>

comments: author: Shah Baloch
body: Hi, [@Arkadiusz Inglot](/t5/user/viewprofilepage/user-id/5254835) 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](https://community.atlassian.com/t5/image/serverpage/image-id/269419iDBDC7106C29BA26D/image-size/large?v=v2&px=999 "automation-7172023.png")


Tags: data-center

edit

issue

jira-server

jql