Could anyone please help me with the code of setting cascading drop-down custom field value as well as single list dropdown using ScriptRunner in Jira workflow post functions.
For the cascading select list please check the Adaptavist script library https://library.adaptavist.com/entity/set-a-default-option-on-a-cascading-select-list
Hi Rajaravikiran,
For the single list drop down you can use the following script.
{code}
// set a desired value in a single select list field
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def cf = customFieldManager.getCustomFieldObject("customfield_xxxxx") // replace xxxxx with your customfield id
def optionsManager = ComponentAccessor.getOptionsManager()
def fieldConfig = cf.getRelevantConfig(issue)
def option = optionsManager.getOptions(fieldConfig).find {it.value == "xxxxx"} // replace xxxxx with the value you want to set in the field
issue.setCustomFieldValue(cf, option)
{code}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.