Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

In Smart Value Text Fields, how to replace MULTIPLE strings with one function

Mee Soo
Contributor
July 14, 2023

Heyyyy,

Imagine a simple automation to Finds & Replace a string in the description of an Issue. When manually triggered, it asks for the old value to find, and the new value to replace it with.

Is there a way to replace multiple different values in a single function (or automation component), or do I need to add a component for each string I want to find/replace?

Something like replaceList()?

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#replace-String-target--String-replacement-

find-replace.jpg

Thanks!

1 answer

1 accepted

4 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.
July 14, 2023

Hi @Mee Soo 

There is no built-in function to do that.  Instead you could chain the operations, such as:

{{issue.description.replace(userInputs.oldValue1, userInputs.newValue1).replace(userInputs.oldValue2, userInputs.newValue2)}}

Kind regards,
Bill

Mee Soo
Contributor
July 14, 2023

Hey thanks, that works :)

Much better than a long list of components.

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