I have been fiddling around with Script Runner for a few hours and cant seem to get a grasp on how to get values from a parent object when creating a sub-task (during creation or post function). I just recently lost my code and have decided that its now time for me to ask.
Could someone help me out, or point me in the right direction on how to learn this bit of code? I know it has to be basic, but for some reason I cant wrap my head around it
You just have to get the issue's parent using Issue.getParentObject(), then reference the new issue the same way you would the current issue. For example (where eventIssue is the issue associated with a triggering event in a Script Listener):
Issue parentIssue = eventIssue.getParentObject(); Collection<Version> parentFixVersions = parentIssue.getFixVersions();
Hmm. I think I understand that. I am having to test all of this in the Script Console on a browser, so the auto-code isn't working at all.
For example, if I wanted to find a issue (to test this on), could I do something like:
Issue parentIssue = eventIssue.getParentObject("TestIssueName"); def SummaryValue = parentIssue.summary;
Or is there some other way to get the info out of it. Is there a MSDN of sorts that I could look at that contains all of the functions/modifiers in a variable?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In Script Console you won't have an "eventIssue" defined. To get a single issue use:
import com.atlassian.jira.component.ComponentAccessor def issueManager = ComponentAccessor.getIssueManager() def issue = issueManager.getIssueObject("ABC-2") if (issue.isSubTask()) { def parent = issue.parentObject // ... }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
MSDN is at https://docs.atlassian.com/jira/latest/
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.