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,298,203
Community Members
 
Community Events
165
Community Groups

Issue Field condition vs JQL

Edited

Trying to setup an automation with a condition where field A contains 1 to many strings... this JQL doesnt work, and the field condition allows to enter only one string.

Is there a more efficient way for doing this? Can you add multiple strings to a field condition? Comma separated? Or a JQL for 'Contains'?

Field A is also a custom field, text.

 

("Account Type" = "New Lead Bookings" OR "Account Type" = "Top of Funnel" OR "Account Type" = "New Lead CSM/Ecomm" OR "Account Type" = "New Lead TOF Restaurants" OR "Account Type" = "New Lead Restaurants")

1 answer

1 accepted

1 vote
Answer accepted

Hi @Sion Dinh 

For a question like this, please consider posting images of your complete rule and the audit log, showing and details.  Those may provide context for the community to offer help.  Thanks!

What is the type of your field: text, single-select, multiple-select, etc.?

Kind regards,
Bill

2022-04-25_17-27-30.jpg

 

Thanks Bill, It's not working due to the JQL, stuck on that!

Looks like a whole list of if/else blocks are my only option? Seems inefficient, and I would have to create a block for every string like this....

2022-04-25_18-05-03.jpg

What type of field is Account Type?

Perhaps this syntax would work better:

"Account Type" IN ("New Lead Bookings", "Top of Funnel", "New Lead CSM/Ecomm", "New Lead TOF Restaurants", "New Lead Restaurants")

I tried 'IN' but as it's a custom text field, single line, it didnt work!

It appears from the rule error that EQUALS = did not work, so perhaps try CONTAINS ~ in a stand-alone query first to see if that works for the text field: https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-operators/#Advancedsearchingoperatorsreference-CONTAINS-CONTAINS--

("Account Type" ~ "New Lead Bookings" OR "Account Type" ~ "Top of Funnel" OR "Account Type" ~ "New Lead CSM/Ecomm" OR "Account Type" ~ "New Lead TOF Restaurants" OR "Account Type" ~ "New Lead Restaurants")

You may also do this with advanced compare condition with a regular expression:

  • first value: your field's smart value of {{issue.Account Type}}
  • condition: exactly matches regular expression
  • regular expression: (New Lead Bookings|Top of Funnel|New Lead CSM/Ecomm|New Lead TOF Restaurants|New Lead Restaurants)

The operator '~' is not supported by the 'Account Type' field Doh!

 

Love the idea about the regex never used that before, although it's not working arrrgghh

2022-04-25_18-42-57.jpg

Please try the "Contains Regular Expression" option instead for that list.

I tried that too, and it didn't work :(

I re-tested with some similar text in the description field and it worked.  Would you please post an image of your advanced compare condition component in the rule?

Thanks for your help Bill!

2022-04-25_19-24-27.jpg

This is the text in UPI-13470 im trying to match...

2022-04-25_19-24-54.jpg

When I tested this it was with Jira Cloud.  Are you using Jira Cloud or Server/Data Center version?  That image looks like it is from Server/Data Center's pro version (paid) of automation.  The Server/Data Center help seems to match Cloud for the example showing this working.

Let's try to write that smart value to the audit log before the condition to confirm it contains what you expect:

START{{issue.Account Type}}END

If that shows nothing for the field, the smart value is incorrect.  You can determine the correct smart value for your field using this how-to article:

https://confluence.atlassian.com/automation/smart-values-for-fields-993924665.html

YES! I had to use the custom field and it worked!

2022-04-27_17-51-48.jpg

 

Seriously this is a gamechanger for me, I can use this regex compare for so many things!!

 

THANK YOU!

Like Bill Sheboy likes this

Awesome!  I am glad to learn that helped.

Suggest an answer

Log in or Sign up to answer
TAGS

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