Automation - How to remove or replace summary text located between brackets

Suzy Nicholson November 23, 2022

Hey everyone, 

I'm looking for some direction on how to remove or replace text from the summary if issues.

Context:
So when an issue is created, we have an automation rule that adds code names from a multi-picker field into the summary between square brackets.
So it goes from "This is the issue summary" to "[CODE NAME 1, CODE NAME 2] This is the issue summary"

Goal:
Now, I'd like to create another automation rule for when the code name field is updated to remove or replace the text within the brackets.

Any ideas would be appreciated.

2 answers

2 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 23, 2022

Hello @Suzy Nicholson 

You can use the "replace" function to replace text in a field using the field's smart value.

Here are a post that might help:

https://community.atlassian.com/t5/Jira-Software-questions/Can-Jira-Automation-replace-edit-part-of-the-summary-field/qaq-p/1574338

(credit to @Bill Sheboy )

 

And on this page you can find information about the "remove" and "replace" functions.

https://confluence.atlassian.com/automation/jira-smart-values-text-fields-993924863.html

1 vote
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 23, 2022

You can do this by using smart values, one that comes to mind would be to use {{issue.summary.substringAfter("] ")}}, that should give you "This is the issue summary" and you can then use that to create your new summary. You can find more smart values that can be used with text fields here.

Suzy Nicholson November 25, 2022

That's a great suggestion. There are also some cases where we might have two sets of square brackets, is there a way to specify the last "] "

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 28, 2022

Yes, you can use substringBeforeLast(String separator) to do that.

Suggest an answer

Log in or Sign up to answer