Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,301,103
Community Members
 
Community Events
165
Community Groups

Set value to a field converted into single Select through Script Runner

Hi All,

 

I created a text field and converted it into a single Select by populating the master data list fetched from the rest endpoint. Behavior script converts into single select on page initialize.

 

Now fetch some data from other rest endpoint and populate to multiple fields, however not able to populate the value to this single select field since it is converted through script runner.

 

The value i'm populating ( set form value ) to this field is already part of the select list options. 

Please advise.

on initialise script in behaviour :

getFieldByName("vendors").convertToSingleSelect([
ajaxOptions: [
url : "http://localhost:8080/rest/scriptrunner/latest/custom/VendorTypes",
query: true, // keep going back to the sever for each keystroke
minQueryLength: 0,
keyInputPeriod: 500,
formatResponse: "general",
]
])

 

Second Behaviour script (Server Side0:

 

if(lotControl!=null){
def field = getFieldByName(vendorFieldName)
def optionsManager = ComponentAccessor.getOptionsManager()

def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(vendorFieldName)
def fieldConfig = customField.getRelevantConfig(getIssueContext())

def options = optionsManager.getOptions(fieldConfig)

def option = options.find {it.value== lotControl}
field.setFormValue(option.optionId)

}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

219 views 2 7
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