For a Custom Picker scripted field is there any way to access the issue
or project
context of the field, similar to the issue
which is available in a standard scripted field?
The following code (or similar for an issue parameter) works fine in isolation but I can’t get it “connected” to the issue/project in the field. I could, possibly, set the project key as a parameter, but was hoping to avoid it
/**
* Filter a given project's list of components by locating components with a given {prefix}
* @param descriptionPrefix The description prefix (inside the {})
* @param project A project object whose components will be filtered (defaults to the ST project if null)
* @return A filtered list of the project's components
*/
static def filterComponentsByProject(String descriptionPrefix, Project project) {
def projectManager = ComponentAccessor.getProjectManager()
def componentManager = ComponentAccessor.getProjectComponentManager()
project = project ?: projectManager.getProjectByCurrentKey("ST")
def components = componentManager.findAllForProject(project.id).findAll {
it.description?.startsWith("{${descriptionPrefix}}")
}
return components.collect {
[
value: it.id.toString(),
displayName: it.name
]
}
}
Could you please clarify, why are you doing this via the Custom Picker instead of using the Issue Picker?
Thank you and Kind regards,
Ram
I am looking to list a filtered set of Components, not issues
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.