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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JMWE Conditional Execution

Edited

Hi Community,

 

I'm trying to use conditional execution in JMWE addon.

 

Below is the condition I'm trying on two text fields. If there is a word approved or deferred text in the field i need to execute this condition.

 

No luck with the below condition.

{{ issue.get("customfield_14802") == /.*Approved.*/ or issue.get("customfield_14802") == /.*Deferred.*/ }}

 

TIA!

 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Ash , you seem to want to use regular expressions in your test. In Groovy, the regex matcher operators are =~ (substring match) and ==~ (exact match). So you can try:

issue.get("customfield_14802") ==~ /.*Approved.*/ || issue.get("customfield_14802") ==~ /.*Deferred.*/

although that will also match "DisApproved" (because you didn't use a word begin/end pattern (\b) and won't match "approved" because you didn't use case-insensitive matching with (?i).

A better test would be:

issue.get("customfield_14802") =~ /(?i)\b(approved|deferred)\b/ 

Thank you @David Fischer _Appfire_ . Appreciate your help as always.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

461 views 5 18
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you