Adaptivist Script Runner - basic select list with other example recipe doesn't work

Brian Bishop
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.
March 12, 2016

Using this as an example: https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/select-list-other.html

the sample code has not effect on the targeted field.  So I tried another approach.  No errors reported in the chrome inspector, lots of errors in the JIRA log.

 

1 error

 

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

General error during instruction selection: java.lang.NoClassDefFoundError: Unable to load class com.onresolve.scriptrunner.runner.customisers.RapidViewServiceBridge due to missing dependency com/atlassian/greenhopper/service/rapid/view/RapidViewService

 

java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class com.onresolve.scriptrunner.runner.customisers.RapidViewServiceBridge due to missing dependency com/atlassian/greenhopper/service/rapid/view/RapidViewService


the script:

def bleedField = getFieldByName('Bleed')
def otherBleedField = getFieldById('customfield_11403')

def bleedFieldVal = bleedField.getValue()
if (bleedValueVal){
if (bleedFieldVal == "Other"){
otherBleedField.setHidden(false)
otherBleedField.setRequired(true)
}else{
otherBleedField.setHidden(false)
}
}else{
otherBleedField.setHidden(true)
}

 

 

So I tried the exact syntax from the example again

 

def otherBleedField = getFieldByName("Bleed (Other)")
def bleedField = getFieldById(getFieldChanged())

def selectedOption = bleedField.getValue() as String
def isOtherSelected = selectedOption == "Other"

otherBleedField.setHidden(! isOtherSelected)
otherBleedField.setRequired(isOtherSelected)

 

and the field is hidden and nothing can be done to change that. And this is a plugin for which I've paid for a 50 user license. Going to file this on their support site (? exists ?) now.

8 answers

1 accepted

2 votes
Answer accepted
Brian Bishop
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.
March 21, 2016

Resolution: put the script in the 'serverside script' input, not the initialiser input. And add the 'other' field to the configuration as a hidden item.

 

Thanks Jamie, this one was operator error.

JamieA
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.
March 21, 2016

no worries, thanks for updating this.

0 votes
Aleksandra Kalischek May 10, 2019

https://scriptrunner.adaptavist.com/5.5.5/jira/recipes/behaviours/select-list-other.html#_make_a_field_writable_only_if_a_certain_value_is_set_in_another_field

The example still not working- last ScriptRunner version (5.5.5).
Resolution: put the script in the 'serverside script' input, not the initialiser input.

Is there any fix? Or description on this page has to be changed

https://scriptrunner.adaptavist.com/5.5.5/jira/behaviours-overview.html

0 votes
JamieA
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.
March 13, 2016

We'll work on the support ticket you have created, then when resolved make an update here for others.

0 votes
Brian Bishop
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.
March 13, 2016

All set. Would you like this issue reported in the support portal?

0 votes
Mark McCormack _Adaptavist_
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.
March 13, 2016

Brian,

Sorry you had trouble signing up to our support portal. Please try this link and choose the Sign up for an account link from there.

0 votes
Brian Bishop
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.
March 13, 2016

Also, I am happy to file a support request at https://productsupport.adaptavist.com/servicedesk/customer/user/login?destination=portals but I don't have a valid username and can't seem to get one.

 

I just tried to move the script into a file, and when I tried to save the behavior with a pointer to a place where I keep my scripts, it fails with the error:

Class must extend class com.onresolve.jira.groovy.user.FieldBehaviours.
   
Enter the package name and class for this validator OR the location of the file.
Enter the name of the method to execute. If you are pointing to a script rather than a class use the method name: *run*

 

 

I see this in the logfile:

 

016-03-13 12:08:49,263 http-bio-8090-exec-56 ERROR admin 728x1315577x3 1axg31p 32.212.197.235,127.0.0.1 /rest/scriptrunner/latest/canned/com.onresolve.scriptrunner.canned.common.StaticCompilationChecker [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: startup failed:

General error during instruction selection: java.lang.NoClassDefFoundError: Unable to load class com.onresolve.scriptrunner.runner.customisers.RapidViewServiceBridge due to missing dependency com/atlassian/greenhopper/service/rapid/view/RapidViewService

 

0 votes
Brian Bishop
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.
March 13, 2016

Hi, thanks Phill. It is version 6.4.10.  There is no JIRA Agile installed.  Once there was, I think as a trial of the plugin.

 

If it helps, I have some script postfunctions that are working fine. That might not be your plugin though, I guess.

0 votes
Phill Fox
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 12, 2016

Please refer to https://scriptrunner.adaptavist.com/latest/jira/getting-help.html for how to request help from Adaptavist in future.

But to pick up and assist you now.

Can you confirm the version of JIRA.

If version 7.x whether this is JIRA Core or JIRA software.

If an earlier version than 7.0 what version of JIRA Agile is installed?

The class reported as missing in your logifiles is part of the Agile implementation in JIRA (greenhopper was the original Agile plugin name)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events