Hi all,
I'm trying to create a costumed field which presents a list of the sprints in the project. (similar to the "Sprint" built-in field, but for different purpose).
since there's no "sprint picker" type - is there a way to use an app (script runner for example) to base a field type on query result?
Thanks in advanced
I can't think of a use for a field like this. Fields belong to issues and you already have the sprint field on issues, so this field would not be adding anything.
Could you explain what you are trying to achieve for the end users?
Hi Nic,
yes, sure, we want to use this feild for shared resource allocation, so one sprint field would be used to set the "desired" sprint, and the other sprint field (the built-in sprint field ) we'll be used to set the actual sprint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't understand how that would be of any use. If you have a "desired sprint", put the issue into it, that's what they're there for.
Resources are not allocated to issues, they are part of a team, and the team sees sprints from their board.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @kerensho
Please check this documentation Select List Conversions
You can create a select list field from a simple text field via behaviours+Rest End Point.
or by another way
Put this code in Initialiser of Behaviours for your issue type
// you should provide list of sprint names for this method
void dynamicCreateOptions(List<String> sprintNames){
//get your field in behaviours style
def cf = getFieldByName("Sprints")
//get your field in Jira Api style
def cfObj= ComponentAccessor.customFieldManager.getCustomFieldObjectsByName("Sprints")[0]
def fieldConfig = cfObj.getConfigurationSchemes()[0].configs.values()[0]
Map options = new HashMap()
for (String sprintName: sprintNames){
//try to find sprintName in existing options
def option = ComponentAccessor.optionsManager.getOptions(fieldConfig).find{ it.value==sprintName}
if (!option){
//creating a new option for custom field
ComponentAccessor.optionsManager.createOption(fieldConfig,0,1,sprintName)
def newfieldConfig = cfObj.getConfigurationSchemes()[0].configs.values()[0]
option = ComponentAccessor.optionsManager.getOptions(newfieldConfig).find{ it.value==sprintName}
}
options.put(option.getOptionId(),option.getValue())
}
//setting full list of options to form
cf.setFieldOptions(options.sort())
}
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.