Forums

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

"Is Contained in" condition in Automations Rules

Michael Davison
Contributor
April 14, 2022
In Automation for Jira, I'm trying to make the validation rules work when comparing two user fields when there's multiple values in one of the fields. Reporter is a single value, but Tester and Approvers can be multiple.
And it goes through a series of if/else conditions based 
  • if reporter in tester
  • if reporter in approver
  • if tester in reporter - this rule fails
  • if tester in approver - as well as this one
I've been using the condition "contains" for this. For example:Screen Shot 2022-04-14 at 9.44.06 AM.png
  • The rules work when a field with 1+ values is checked against a single value, i.e. (1, 2) contains (1) = True
  • But it doesn't work when you flip it: (1) contains (1,2) = False

I'm trying to set up a condition like, "Is one of", "Is contained in"... but there isn't a selection on the dropdown for this:

Screen Shot 2022-04-14 at 9.56.52 AM.png
Anybody have any ideas how to set up "Is Contained In" using Automation for Jira?

2 answers

2 accepted

1 vote
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.
April 14, 2022

Hi @Michael Davison 

Your user custom field is a list, and so the parsing may not be correct for that advanced compare condition of "contains".  Perhaps take a look at the example in the documentation for testing the Components field: https://support.atlassian.com/cloud-automation/docs/jira-automation-conditions/#Advanced-compare-condition

And if you modify the second value field and use Contains Regular Expression:

({{#issue."Tested & Accepted By (Jira User)"}}{{displayName}}{{^last}}|{{/}}{{/}})

This will split your custom field names into a list delimited by the pipe character to work as a regular expression of possible values.  Note: please check if I correctly typed your custom field name.

Kind regards,
Bill

0 votes
Answer accepted
Sam Bartolome
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.
April 14, 2022

Hi @Michael Davison ,

Could you try to recreate the condition via JQL instead?

Michael Davison
Contributor
April 14, 2022

Yes! I can use "IN" for "Is contained in"

And then "~" for Contains... 

Thanks so much. I knew I was missing something. Thanks Sam.

Suggest an answer

Log in or Sign up to answer