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 vote

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 vote

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Apr 19, 2018 in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

366 views 0 6
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