Missed Team ’24? Catch up on announcements here.

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

Need a Multiple User selection expression for JMWE validator

Jamie Gordon May 15, 2023

I'm creating a Validator that checks to see if a multi-user selection field (issue.customfield_11887) doesn't contain the Issue reporter. 

I've tried the following, but it doesn't seem to work. 

!!issue.customfield_11887 || issue.reporter

Any clues would be appreciated. 

Thanks

Jamie

2 answers

1 vote
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2023

Hi @Jamie Gordon 

try this instead:

!issue.customfield_11887 || !issue.customfield_11887.some(u => u.accountId == issue.reporter.accountId)
1 vote
Joseph Chung Yin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 15, 2023

@Jamie Gordon -

Hi Jamie:

You cannot use the "||" operator, because it means a OR testing.  Your code is customfield_11887 is not empty or "reporter".  The reporter test is not doing anything.

You may need to obtain the reporter information (i.e. issue.reporter.accountId) first, then compare it with content of your other custom field.

Take a look on using Jira Expression when creating your Scripted (Groovy) Validator via JMWE -

https://developer.atlassian.com/cloud/jira/software/jira-expressions-type-reference/#user

At this time, I have not constructed the script to test it out due to my other work related tasks.

Hope this helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

Suggest an answer

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

Atlassian Community Events