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

Error while using "Select List Conversions" behaviour of script runner

Rajat Gupta March 30, 2016

I am trying to script a drop down field  based on https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html#_walkthrough_pick_from_jira_issues which will load its values based on jql. 

However, when I try to give the same initializing script it gives me following error message:

image2016-3-30 18:2:49.png

Can you please let me know what am I missing?

7 answers

0 votes
adammarkham
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.
April 1, 2016

I assume by releases you mean versions? You would need to create your own REST endpoint for this. For an example look at: https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html#_create_and_test_endpoint

In that endpoint you would need to use the following code to get the version names as the "value" for a particular project:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.ProjectManager

def projectManager = ComponentAccessor.getComponent(ProjectManager)
def versionNames = projectManager.getProjectByCurrentKey("PROJ").versions*.name
0 votes
Rajat Gupta March 31, 2016

Ahh.. it turns out to be environment issue. Static checker doesnot give any error  in different environment.  I am able to implement. However, is it possible to have a drop down giving "Releases" instead of "issue keys"

0 votes
adammarkham
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 31, 2016

I can't reproduce it with those versions when I add it as the initialiser, the type checking is successful. Is it possible you are putting the script somewhere other than the initialiser?

You may find that the behaviour works even though the static type checker complains.

Screen Shot 2016-03-31 at 15.09.48.png

0 votes
Rajat Gupta March 31, 2016

script runner version is 4.2.0.7

JIRA version is : 7.0.5

0 votes
adammarkham
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 31, 2016

What version of ScriptRunner and JIRA are you using?

0 votes
Rajat Gupta March 31, 2016
here is the script:

getFieldByName("Summary").convertToSingleSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner-jira/latest/issue/picker",
query: true, // keep going back to the sever for each keystroke

// this information is passed to the server with each keystroke
data: [
currentJql: "project = NPDAAA ORDER BY key ASC",
label : "Pick high priority issue in Support project",

// specify maximum number of issues to display, defaults to 10
// max : 5,
],
formatResponse: "issue"
],
css: "max-width: 500px; width: 500px",
])

 

0 votes
Steven F Behnke
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 30, 2016

Could you post the script?

Suggest an answer

Log in or Sign up to answer