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.
×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?
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,
Regards,
Radhika
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.