I have a ScriptRunner Customer Picker field that presents a list of options retrieved from a REST endpoint. This works just fine and the field is used on a few various screens in different projects.
In one of the projects, the field is on a sub-task screen. I want to use information from the parent issue to filter the list on the sub-task Create Issue screen but I cannot figure out how to access the parent issue information. I can't use the standard "issue" context because it's null since the sub-task has not been created yet.
I can access the parent issue information from a ScriptRunner behavior but I can't figure out how to dynamically alter the picker logic. Even if that's possible ideally I'd like to figure out how to do this in the Script Field so that all the logic is contained in one place.
Hi @Chris Kite ,
you can retrieve parent issue in create screen through the following code :
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue;
...
def parent = getFieldById("parentIssueId");
Long parentIssueId = parent.getFormValue() as Long;
IssueManager issueManager = ComponentAccessor.getIssueManager();
Issue parentIssue = issueManager.getIssueObject(parentIssueId);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Tricky one - maybe you can achieve this by passing the parent issue key as a URL parameter when calling the REST endpoint and then using it to filter the results. It's just an ideea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can easily do the filtering via passing by URL parameter, that's not the problem.
The problem is getting the parent issue key when on the sub-task CREATE screen. Since the sub-task does not exist yet so "issue" context is null.
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.