Any Idea!!!!!
This should be possible through Script Runner also I didn't tried it by myself. You need the OptionsManager (as already mentioned by Chaithra)
OptionsManager optionsManager = ComponentAccessor.getOptionsManager()
and the createOption() method of this manager. You can get the fieldConfig for this method for the current issue and the customfield cf like this
def fieldConfig = cf.getRelevantConfig(issue)
If it's a single select list the parentOptionId is null. But you have to set a valid sequence and I think to get a valid sequence value you have to get all options for this fieldConfig (optionsManager.getOptions(fieldConfig)) and determine the next sequence number.
Henning
hi,
Yes you can do this by writing custom post function.
Refer com.atlassian.jira.issue.customfields.manager.OptionsManager for more details on creating options etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont know about script runner, but we had done this in JIRA Service/ JOB Plugin. So this is doable in postfunction
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can it be done via script runner?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any sample on how to implement?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please find the sample
Issue issue
CustomField customField
String value; //value to be added as option
Option opt = null;
FieldConfig relevantConfig = customField.getRelevantConfig(issue);
List<Option> options = optionsManager.findByOptionValue(value);
if(null != options){
for (Option option : options) {
FieldConfig fieldConfig = option.getRelatedCustomField();
if (relevantConfig != null && relevantConfig.equals(fieldConfig)) {
return option;
}
}
}
if(!value.equals(""))
opt = optionsManager.createOption(relevantConfig, null, (long) 0, value);
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.