Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

JWME expression question

Michael Holian
Contributor
June 10, 2020

I'm trying to perform a transition validator, If the resolution on the screen is 'Done', then the Time Entered needs to be above zero. I entered this condition in my field required (JWME) validator:

(issue.timeSpent != null && issue.resolution.name == 'Done') || issue.resolution.name != 'Done'

meaning, if the resolution (as set on the transition screen) is Done and they have not entered time, they need to on this field, OR, if the resolution from the transition screen is another value, I don't require time entry.

I'm thinking I'm getting the value of issue.resolution.name from the issue rather than from the transition screen based on how this runs in a test.

I did find in JWME an example syntax that I'm curious about. it was: !!issue.customfield_10202 && issue.customfield_10202 > 0

What does the !! before issue do? Does that point to the transition screen value?

1 answer

1 accepted

1 vote
Answer accepted
Radhika Vijji _Innovalog_
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.
June 11, 2020

Hi Michael,

No, the value of issue.resolution.name is indeed from the transition screen. issue.timeSpent != null will return true if you have already logged work against the issue before the transition. But if you hadn't logged time at all, then, when the Resolution is Done the validator will force the user to input the Time Spent. So in your case, you might have already had time logged on the issue.

issue.timeSpent returns Total time spent on the issue, not just the work logged on the transition screen.

!! is not not. For example, 

  • issue.assignee returns a user object
  • !issue.assignee returns true when the Assignee field is empty
  • !!issue.assignee returns true when the Assignee field is not empty

Regards,

Radhika

Michael Holian
Contributor
June 11, 2020

Thank you, Radhika, for the tremendously detailed answer. From this, I was able to make this transition rule work properly.

 

I had overcooked the code a little bit, the 'or' part of my logic should not have been there, and with your help I ended up implementing:

(!issue.timeSpent && issue.resolution.name == 'Done') and it seems to work correctly.

I'm grateful for your assistance. My next challenge is to see if I can roll up time spent from any sub-tasks!

Regards, Michael

Suggest an answer

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

Atlassian Community Events