Forums

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

How to use the replace function with a user input

Oleg November 24, 2023

I have a manual triggered automation which takes in a user input called Version.

I would then like to change the summary text "x.y.z" using the replace function to the Version that the user inputs. Trying this but it fails during the automation run 

{{issue.summary.replace("x.y.z", "{{userInputs.Version}}")}}

Have tried without the quotes too {{issue.summary.replace("x.y.z", {{userInputs.Version}})}}

 

Welcome to any suggestions on how to accomplish this, or if there is another way without replace but "x.y.z" is in the middle of the summary.

1 answer

1 accepted

0 votes
Answer accepted
Ste Wright
Community Champion
November 24, 2023

Hi @Oleg 

Can I confirm the logic is...

  • When the Version field is updated (not NULL)
  • Change the Issue's Summary to be that wording

...?

Is that a standard Version field (i.e fixVersion or affectedVersion) - or is that a custom field? If custom, what field type is it?

Ste

Oleg November 24, 2023

Version is user input data when triggering the automation, "Prompt for input when this rule is triggered"

It's not a field on the issue. 

Ste Wright
Community Champion
November 24, 2023

Hi @Oleg 

Can you post your current rule's details (screenshots would be great).

Ste

Oleg November 24, 2023

Screenshot 2023-11-24 at 11.00.54.png

Ste Wright
Community Champion
November 24, 2023

Hi @Oleg 

Is "x.y.z" always in the same place in the Summary?

Ste

Oleg November 24, 2023

Yes it is

Ste Wright
Community Champion
November 24, 2023

Hi @Oleg 

I think I have this working as required, using two separate actions...

  1. Remove "x.y.z", and then...
  2. Add userInputs.Version

---

  • Trigger: Manual Trigger
    • Prompt for input... = TRUE (checkbox)
      • Field = Short Text
      • Name = Version
      • Variable Name = Version
  • Action: Edit Issue
    • Field = Summary
      • Value = {{issue.summary.remove("x.y.z")}}
  • Action: Re-fetch issue data
  • Action: Edit Issue
    • Field = Summary
      • Value = {{userInputs.Version}} - {{issue.Summary}}

---

Then, you would just need to update the final action to align to your Summary model!

Let us know what you think!

Ste

Like Oleg likes this
Oleg November 24, 2023

That works. thank you

Like Ste Wright likes this
Ste Wright
Community Champion
November 24, 2023

Excellent!

If this answer did help, could you accept it? That lets others know in future it can help them too :)

Ste

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events