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?
issue
project
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
<span>/** * 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 */</span> <span>static</span> def <span>filterComponentsByProject</span><span>(String descriptionPrefix, Project project)</span> { <span>def</span> <span>projectManager</span> <span>=</span> ComponentAccessor.getProjectManager() <span>def</span> <span>componentManager</span> <span>=</span> ComponentAccessor.getProjectComponentManager() project = project ?: projectManager.getProjectByCurrentKey(<span>"ST"</span>) <span>def</span> <span>components</span> <span>=</span> componentManager.findAllForProject(project.id).findAll { it.description?.startsWith(<span>"{${descriptionPrefix}}"</span>) } <span>return</span> components.collect { [ value: it.id.toString(), displayName: it.name ] } }
Hi @Oskar Austegard
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
It looks like you're new here. Sign in or register to get started.