How to get parentIssueId for a sub-task with Behaviours (Script Runner)?

According to the Behaviours documentation, one should be able to retrieve the ID of the parent issue of a sub-task in an initialiser script like this:

FormField parent = getFieldById("parentIssueId")

Am I doing something wrong as parent.value is always null?

An open issue SRJIRA-253: Cannot get parentIssueId value seems to perfectly capture what I'm experiencing. There are no comments on that issue or any other hints about what could be going wrong. Any hints or pointers would be highly appreciated.

I'm using Script Runner 3.1.4 on JIRA 6.4.1.

1 answer

1 accepted

1 vote

What you have above won't work in an initialiser but if its attached to a field it will work. Please see the answer here: https://answers.atlassian.com/questions/17894295

You can use:

underlyingIssue.parentId

Or to get the full issue object use:

underlyingIssue.parentObject

Somehow this was not easy to grasp from the documentation. I ended up not using the initialiser but scripts for individual fields.

Thanks!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

80 views 0 5
Read article

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