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

Accepted Answer
0 votes

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: https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/108200050/Standard+JIRA+fields#StandardJIRAfields-Parent

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: https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/138405679/Custom+Nunjucks+filters#CustomNunjucksfilters-parentIssue

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
Posted Thursday in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

326 views 3 5
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