Hi All,
I'm trying to upadte slect list custom field while creating an issue - Using below script for this,
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.customfields.manager.OptionsManager def componentManager = ComponentManager.instance def optionsManager = ComponentManager.getComponentInstanceOfType(OptionsManager.class) def customFieldManager = componentManager.getCustomFieldManager() def cf = customFieldManager.getCustomFieldObjectByName("Blocking status") def fieldConfig = cf.getRelevantConfig(issue) def option = optionsManager.getOptions(fieldConfig).find {it.value == "Blocked"} issue.setCustomFieldValue(cf, option)
This code is working in all other places except at creating an issue (eventhough I placed this script in last in order).
Is something I need to change in code for making this works at create issue wrokflow transition?
Thanks,
Sanu P Soman
Have a look here. You have to add cf.updateValue. More details on the link.
It works with,
issueManager.updateIssue(authenticationContext.getLoggedInUser(),issue,EventDispatchOption.DO_NOT_DISPATCH,true);
Many thanks for the help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The issue might not still exist when you're executing the code, so that's why it may not return proper value for the option.
Add some trace in the script to see what does the fieldConfig and option vars are not null. If they are null then check if the issue has project and issue type field set, as if they're not set fieldConfig will be alwas null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kostas answer seems more precise... so check it first :)
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.