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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In which JMWE post-function are you trying to do this, and on which workflow (issue or subtask)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using "Transition current issue", on a subtask.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.