JMWE Transition - how to access parent issue in a condition

Using JMWE in Atlassian cloud, so Nunjucks not groovy.

I want to transition a subtask depending on a criteria of it's parent Story / Bug / whatever. The trouble is, parentIssue is null.

There's reference in the documentation that parentIssue is only set when operating on the parent issue. I read that as for example transitioning the parent issue.

Any way around this? Any way to access the parent in the condition?

2 answers

1 accepted

0 votes
Accepted answer

In the Transition Issue post-function, only the "issue" variable is defined.

You can still access the parent issue of the current issue, using issue.fields.parent, which returns an object representing the parent issue, as documented here:

However, this object only contains a subset of the parent issue's fields, so you need to make sure the field you're interested in is available by "dumping" it first using the Template Tester:

{{ issue.fields.parent | dump(2) }}

If the field you're interested in is not there, you'll need to use the "parentIssue" filter instead, as described here:

Thanks David. I tried issue.fields.parent, it was null using the template tester. At least yesterday it was null. I've tried it again today and it's not, I can only guess that I was probably typing the parent issue key rather than the subtask into the template tester, or something silly like that.

Bonus, I didn't know about dump, that's dead useful.

Thanks for your help.

0 votes

In which JMWE post-function are you trying to do this, and on which workflow (issue or subtask)?

I'm using "Transition current issue", on a subtask.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

465 views 8 27
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