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 have a script that works in Jira 4.2 and groovy version 1.7.13
!(cfValues['Requested start date']!=cfValues['Requested end date']&&!(cfValues['Requested daytime'].equals("Whole day")))
Requested start and end date are date pickers (no time), requested daytime is a radio button field with options morning, afternoon and whole day.
Now i want to have the same script, but in groovy version 1.7.3-1 (and jira 4.2)
The exact same script doesn't work.
when i do
println cfValues['Requested daytime']?.value
println cfValues['Requested daytime']?.getValue()
it both gives me 'null'
println cfValues[10053] (req dt's id) also gives null
Does the 1.7.3-1 version know how to take care of radio button fields?
Upgrading to 1.7.13 (or higher) is not an option (unless there's no other choice)
The rule didn't work so didn't used it.
Annyone with better ideas?
This is correct:
cfValues['Requested daytime'].value
if it's a select list or radio buttons etc.
The return type of "println" is void, which is why it would show null. If you open the catalina.out file you would see the output there.
Try using an assertion in the condition tester: https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-PowerAssertions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't know why, but assert doens't seem to show anything ...
(or certainly not like it's in your example)
It only gives me an error
Trying it out with the .value, keeping you informed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where is catalina.out default located?
Not in the C:\Program Files (x86)\Atlassian\JIRA 4.2.4-b591\logs folder
catalina.log does exist, nothing special in there
error doesn't appear when it should
My function:
!(cfValues['Requested start date']!=cfValues['Requested end date']&&!(cfValues['Requested daytime'].value.equals("Whole day")))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's platform dependent but that's not my point, my point was not to use println and expect to see the result on the screen.
>> My function
Do it one clause at the time, in the condition tester.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tested it on a wrong (should be non-existing) issue
start and end date on different day and requested daytime is morning
!(cfValues['Requested start date']!=cfValues['Requested end date']&&!(cfValues['Requested daytime'].value.equals("Whole day"))) -> false
!(cfValues['Requested daytime'].value.equals("Whole day")) -> true
cfValues['Requested start date']!=cfValues['Requested end date'] -> true
So theoritically, the issue shouldn't exist cause the validator rule is good
However the rule doens't work
An issue with different dates and daytime not to whole day, gets created
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
However if I check with the conditioner on a good issue
2 different dates and whole day
cfValues['Requested daytime']=="Whole day" -> true
cfValues['Requested daytime'].value=="Whole day" -> false
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You wouldn't get Atlassian support for this version of jira, and personally I'm not inclined to either, it;s just too old, and too much has changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should use:
cfValues['Requested daytime']?.value= ...
unless you know this field will ALWAYS be filled in.
I don't understand the difference between a good and bad issue.
I think on such an old version of jira you just don't want .value. You will need to change that when you upgrade to 4.4.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
-These fields are all required.
-bad issue=requested start date different from requested end date and requested daytime is morning or afternoon
good issue= all other possibilities
So it may not be possible to create an issue with an afternoon/morning spread over multiple days
-One day we will upgrade to a newer version ..., but it's not this day.
Until that day, how can I make it work ??
-Great now I'm getting always error messages :(
This should work according to the condition tester , but when i put it in a validator rule in my workflow, it doesn't work...
(!((cfValues['Requested start date']!=cfValues['Requested end date'])&&!(cfValues['Requested daytime'].equals("Whole day"))))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
println cfValues[10053][0] gives javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getAt() on null object
My req dt is on the screen and is filled in ..
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.