Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Behaviour script to set single select list field not working Edited


i am using the below code in the behaviours to set the value for the field select list based on the value of the other field,

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.fields.config.FieldConfig;


def productField=getFieldById(getFieldChanged());

def qaCertField = getFieldById('customfield_13944');

def pnv = pnvField.getValue() as ArrayList<String>;


if(pnv.size()>0 ){

String product = pnv.get(0);
def customFieldQACert = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName('customfield_13944')

def fieldConfigQACert = customFieldQACert.getRelevantConfig(getIssueContext());

OptionsManager optionsManagerQACert = ComponentAccessor.getOptionsManager();

def optionsQACert = optionsManagerQACert.getOptions(fieldConfigQACert);

def optionQACert;

if(product == "Apple") {
optionQACert = optionsQACert.find {it.value == "Yes"}
optionQACert = optionsQACert.find {it.value == "No"}


0 answers

Suggest an answer

Log in or Sign up to answer

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