Hi,
I've recently started using JIRA Scripting Suite and have been able to work out how to do everything I've needed to do, other than setting the value of a custom checkbox field in a post function. My checkbox field only has one component, and I'm trying to cause it to be selected for a certain issue type in a post function. My script is shown below - it doesn't produce an error other than to state that "JIRA couldn't create the issue right now". Any help would be much appreciated.
from com.atlassian.jira.component import ComponentAccessor customFieldManager = ComponentAccessor.getCustomFieldManager() cf_chk1 = customFieldManager.getCustomFieldObjectByName("chk1") values = [{ "true": "Requires Attention" }] if issue.getIssueTypeId() == "10000": customFieldManager.getCustomFieldType().updateValue(cf_chk1, issue, values)
Community moderators have prevented the ability to post new answers.
Hi,
I'm not an expert but afaik you need to pass an array of com.atlassian.jira.issue.customfields.option.Option as value.
Something along the lines of:
from com.atlassian.jira.component import ComponentAccessor customFieldManager = ComponentAccessor.getCustomFieldManager() optionsManager = ComponentAccessor.getOptionsManager() cf_chk1 = customFieldManager.getCustomFieldObjectByName("chk1") # get Option for 'Requires Attention' fieldConfig = cf_chk1.getRelevantConfig(issue) options = optionsManager.getOptions(fieldConfig) requiresAttention = options.getOptionForValue('Requires Attention', None) if issue.getIssueTypeId() == "10000": issue.setCustomFieldValue(cf_chk1, [requiresAttention])
Thank you so much - it worked like a dream first time! You wouldn't believe how many different attempts I've made to set a checkbox field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.