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 validator logic - Jira expression Edited

I have a transition that needs validation before continuing. Because it's a bit more complex,

I'm using JMWE with a jira expression. Unfortunately, my logic is turned around, and for the life of me I can't seem to get it correct. (I'm a long-time dev, so this is hurting my ego :))

I have an issue type with a field called Support Rep (customfield_10119). There are three possible outcomes of clicking this specific transition:


  1. The support rep field is populated and the value doesn't match the current user. Return false and throw the custom error message.
  2. The support rep field is populated and the value does match the current user. Return true and allow the transition to continue.
  3. The support rep field is not populated. Return true and allow the transition to continue.

My current validator code is not working for cases 1 and 2; case 1 allowed me to transition (when the support rep was not me) and case 2 showed the custom error and did not allow the transition (when the support rep was me.) Case 3 works correctly.

Can someone help me out? I've tried changing the order of my conditions; tried changing from OR to AND, etc. and nothing seems to work.

 

2019-09-16_1050.png

ETA: I tried changing my expression to this, and now the first two scenarios work but the third doesn't.

 

(issue.customfield_10119 != null && user.accountId == issue.customfield_10119.accountId) || issue.customfield_10119 == null

1 answer

1 accepted

1 vote
Answer accepted

Hi,

I believe you want:

!issue.customfield_10119 || user.accountId == issue.customfield_10119.accountId

Of course, that assumes  customfield_10119 is a single-user picker custom field.

Thank you! That's what I needed.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

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