To validate issue subtype we have a simple scripted Validator.It was wrking fine in JIRA 4.2.But throws error in 5.2 .10 version.Can someme pls confirm if there is any syntax change is required?
cfValues['Issue sub-type'] == 'Enhancement' || cfValues['Issue sub-type'] == 'Defect' || cfValues['Issue sub-type'] == 'Role Change' || cfValues['Issue sub-type'] == 'New Development' || cfValues['Issue sub-type'] == 'Configuration Change'If the custom field is a select field you will now get an Option object instead of a string. Try cfValues['Issue sub-type'].getValue() instead of cfValues['Issue sub-type']
Thanks Much Henning.It works now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you pls tell if there is any change required in the below script?
def e = customFieldManager.getCustomFieldObjectByName('Level of Effort')
def i = customFieldManager.getCustomFieldObjectByName('Impact on functionality')
issue.getCustomFieldValue(e) != null && issue.getCustomFieldValue(i) != null
I have this scripted validator for "Generate Checklist" transition.Getting [InvalidInputException: [Error map: [{}]] [Error list: [[The Level of Effort and Impact on functionality fields must be completed prior to generating the checklist.]]]
This was working good in 4.2 ,Could you please help?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looks good for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
My scripted validtaor gets failed (Message given in
Error Message field is getting diaplyed)when I issue the code as below
def e = customFieldManager.getCustomFieldObjectByName('Level of Effort')
def i = customFieldManager.getCustomFieldObjectByName('Impact on functionality')
issue.getCustomFieldValue(e) !=null || issue.getCustomFieldValue(i) !=null
Where as it gets thru when I modified the condtion for ==(as below)
def e = customFieldManager.getCustomFieldObjectByName('Level of Effort')
def i = customFieldManager.getCustomFieldObjectByName('Impact on functionality')
issue.getCustomFieldValue(e) ==null || issue.getCustomFieldValue(i) ==null
But My requiremet is !=null should get pass.
So here the problem is def e def i are getting interpretted as null.. can you please help to pass this validator?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What's the error message? Are the names of the CFs correct? Try to debug with log.debug "" messages what the values of e and i are.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got it fixed henning..Actually these fields needs to be set via the JIRA Ticket.Since Iam new to JIRA .. I didnt understand the basics.
thanks much for your reposnse.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henning
I get the below error in Script14.groovy.(there is no such groovy in the script path)
2013-08-12 04:14:58,985 http-6443-17 ERROR wb391456 254x2016x17 ugih9r 10.185.5.137,10.185.160.15 /secure/WorkflowUIDispatcher.jspa [onresolve.jira.groovy.GroovyCustomField] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:Script14.groovy: 1: expecting '(', found 'Issue' @ line 1, column 4. if Issue Classification = "System Change" ^ 1 error javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:Script14.groovy: 1: expecting '(', found 'Issue' @ line 1, column 4. if Issue Classification = "System Change" ^ 1 error at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:216) at javax.script.ScriptEngine$eval.call(Unknown Source) at com.onresolve.jira.groovy.GroovyCustomField.getValueFromIssue(GroovyCustomField.groovy:150) at com.atlassian.jira.issue.fields.CustomFieldImpl.getValue(CustomFieldImpl.java:384)
Can u pls tell the cause for this kind of error?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's an error from the code of a scripted field. There must be a line like
if Issue Classification ...
The condition of an if statement has to be in ().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henning,
Below is the Multi Checklist field script Validator.
// set properties default value if missing
def cp = customFieldManager.getCustomFieldObjectByName('Checklist Properties')
def properties = issue.getCustomFieldValue(cp)
properties?.contains("Default checklist items for Overall Impact level")
Here always it gets evaluated to false and I get the error message I defined.
Pls help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try def properties = issue.getCustomFieldValue(cp)?.value, because it's an Option object for fields with multiple possible values.
The error message must be from another script.... do you have other scripts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Still getting the same error(here error I meant is the error defined by me to be thrown when the condition is not satisfied ,But the checkbox of "Default checklist items for Overall Impact level" is checked already in the Checklist description )
// set properties default value if missing
def cp = customFieldManager.getCustomFieldObjectByName('Checklist Properties')
def properties = issue.getCustomFieldValue(cp))?.value
properties?.contains("Default checklist items for Overall Impact level")
I get this error becoz the variable properties is not reading the value as it expects.
Kindly help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Error at log :
java.lang.ClassCastException: java.lang.String cannot be cast to com.atlassian.jira.issue.customfields.option.Option
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is an ")" to much before the question mark in the def properties row.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry ,that was a typo error.) is not there in my script validator.
// set properties default value if missing
def cp = customFieldManager.getCustomFieldObjectByName('Checklist Properties')
def properties = issue.getCustomFieldValue(cp)?.value
properties?.contains("Default checklist items for Overall Impact level")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try this and post the log.
// set properties default value if missing def cp = customFieldManager.getCustomFieldObjectByName('Checklist Properties') log.error "customFieldManager: $customFieldManager" log.error "cp: $cp" def properties = issue.getCustomFieldValue(cp)?.value log.error "value: ${issue.getCustomFieldValue(cp)}" log.error "value.class.name: ${issue.getCustomFieldValue(cp)?.class?.name}" log.error "value.value: ${issue.getCustomFieldValue(cp)?.value}" log.error "properties: $properties" log.error "properties.class.name: ${properties?.class?.name}" properties?.contains("Default checklist items for Overall Impact level")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.