Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,361,817
Community Members
 
Community Events
168
Community Groups

JMWE Conditional Execution

Edited
Ash Rising Star Nov 23, 2020

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/ 
Ash Rising Star Nov 24, 2020

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

Apps for Confluence you won't want to miss: RSVP for September's Appy Hours

Calling all collaborators and Confluence users! Our Appy Hours event on September 29th features 4 presenters demoing functionality to superpower Confluence. Don't miss learning about these apps i...

125 views 0 9
Read article

Atlassian Community Events