Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Get Value of Cascading Select on Screen

I have a screen with a cascading select list called "Root Cause", if the second list = to "Cannot Reproduce" I want to set the Resolution field to "Cannot Reproduce" automatically for the user. I'm having trouble with reading the values in the Root Cause field though. I'm using Behaviours in Script Runner to accomplish this. I have the script on the Root Cause field. 

import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION

def rootCause = getFieldByName("Root Cause")
def rcVal = rootCause.getFormValue() as Map

if (rcVal.get("1") == "Cannot Reproduce")
//This part works, the if statement doesn't
def constantsManager = ComponentAccessor.constantsManager
def allowedResolutions = constantsManager.resolutions.findAll
{ in ["Cannot Reproduce"]



1 answer

1 accepted

The script is correctly on the Root Cause field but it has some mistakes:

  • To get the value of a field use getValue()
  • To set the value of a field use setFormValue() and not setFieldOptions()
    • setFieldOptions() is used to set the available options for fields such as checkboxes or radio buttons

      Take a look at the Behaviours API to see available methods.

  • You can access the resolutions from the ResolutionManager and not the ConstantsManager

Correct script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.ResolutionManager

def resolutionManager = ComponentAccessor.getComponent(ResolutionManager)
def resolutionToSet = resolutionManager.getResolutionByName("RESOLUTION_NAME")

def resolutionField = getFieldById("resolution")

def selectListField = getFieldById(fieldChanged)
def selectListValue = selectListField.value

if (selectListValue.size() > 1 && selectListValue[1] == "SELECT_LIST_OPTION_NAME") {

@Roland Holban _Adaptavist_

Thanks for the update to set the resolution, but Behaviours doesn't like

selectlistValue.size() and selectListValue[1] 

Note, the Root Cause field is a Cascading Select List..

behaiour 1.pngbehaiour 2.pngbehaiour 3.png

Dont worry about those errors. The static type checker cant always correctly infer variables types. You can read more about it here:

Also, I changed the script a bit. Make sure you grab the new one.

Awesome.. Thank you. That worked perfectly.

I am getting "cannot invoke method size on null object"?

I cannot seem to get the value of my Multi Select list? 

Suggest an answer

Log in or Sign up to answer
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

86 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you