I'm new to JIRA/Script Runner
I want to display issues in a mutlipicker "ModulesPicker" using setConfigParam method by the workflow custom script post-function.
But console editor says "Cannot find matching method java.util.Collection#setConfigParam....
My code is as below.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
def issueManager = ComponentAccessor.getIssueManager()
def issueFactory = ComponentAccessor.getIssueFactory()
def subtaskManager = ComponentAccessor.getSubTaskManager()
def customFieldManager = ComponentAccessor.customFieldManager
def issuePicker = customFieldManager.getCustomFieldObjectsByName("ModulesPicker")
issuePicker.setConfigParam('currentJql','project = XXX')
What's wrong? Thanks in advance.
Welcome to the Community!
There's a lot of things wrong here, and there's no direct and simple answer because of that.
I'm guessing you got this code from somewhere like Stack Overflow, which tends to contain a lot of really really terrible and wrong answers because it is too generalised and not curated by people who actually understand the subjects being discussed.
Could you explain what you are actually trying to do here? Display issues with some calculated data (and why you're not using a scripted field for it), or set some values in a field automatically? Either way, you would be better off using library.adaptavist.com to base scripts on.
@Nic Brough -Adaptavist-
Thank you for your answer.
My final intention is to have two ISSUE PICKERs,
then when a user selects an issue in the first PICKER, then the subtasks of the issue will be displayed in the 2nd PICKER.
I want the selecting action for issue in 1st PICKER to be continuously.
I want to be able to continuously perform the action of selecting an issue with 1st Picker
So, I thought that Listener which occurs page transition and Fields which is one-time action could not be handled.
This is reason why I tried to use post-function in Workflow.
(My code I wrote earlier is just the first step.)
Is my idea wrong?
Is there a better another way?
Anyway, I realized that I didn't know about JIRA/Script Runner too much.
Thank you your advices.
I have to study more and more before visiting here again...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can't do this with scriptrunner or any other customisation tool.
You would need to write an entirely new field to handle it.
What you have defined here is a variant cascading-select, where instead of the first half of the field being a select list option, it is an issue picker. You can do those, there are apps that provide them (but they tend to be clumsy, and in most cases, it's better done with an issue link)
the second half of the field would have to be dynamically rebuilt on-screen, from the list of sub-tasks on the issue selected in the first half. That would mean dynamic javascript to populate it, not a list of options.
That's not an impossible task, but you are going to have to write a full app to provide the field like this.
May I ask what problem you are actually trying to solve with this idea?
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.