Access to parent issue field in in create sub-task listener

Hello,

I'm trying to access parent issue fields in the "Create a Sub-Task" Builtin Listener.

I've tried the following:

issue.getParentObject().getDescription()

issue.parentObject.description

event.issue.description

But all I get is a null value.

My use case is that i want to copy the description and other values from the parent to the subtask when creating a new sub-task.

Does somebody have an idea how to access the parent values?

Regards,

Adrian

1 answer

1 accepted

This widget could not be displayed.

I think the problem is that the subtask is still not created when the script is executed, so it still does not have parent issue. I also did not find the parrent issue anywhere in the context of the script.

As an alternative you might use the "Set Field Value from Parent" post function from JIRA Misc Workflow Extensions plugin if you have it installed, so if you put this postfunction after create subtask postfinction it will set all the fields

Another alternative is to modify the built-in script to include the parent issue in the context of the script.

Something like the following should do the job (before line 116 in CreateSubTask.groovy)

transientVars.put("parentIssue", issue);

More info here - https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Built-InScriptsHackingNotes

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

578 views 25 15
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you