JMWE parent issue filter access

Paul Alexander
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2022

From the JMWE documentation, when I apply any of these three filters to any post function's template and test it from within the post function, it returns nothing. I pass it a valid subtask whose parent that is a standard issue type has an epic link.

These three examples are pulled from here:

Custom Nunjucks filters - JMWE for JIRA Cloud - Confluence (atlassian.net)

I'm trying to understand how to work with these filters, but I guess I'm missing some syntax. If I can figure out how this works, I can apply this knowledge to get what I need. Please and thank you.

{{ issue | parentIssue }}
{{ issue  parentIssue("status") | field("fields.status.name") }}
{{ issue | parentIssue | field("fields['Epic Link']") }}

Your template ran successfully

Result value:

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 26, 2022

Hi @Paul Alexander 

The first line will display [Object object] because the result is an object (the full parent issue). But if you try this:

{{issue|parentIssue|dump(2)}}

You will see the full details of the parent issue.

However, did you try it on a sub-task that belongs to a company-managed project? JMWE doesn't support team-managed projects. 

Paul Alexander
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2022

Hi David. When I run this against a subtask in a company-managed project, it returns nothing. I'm pointing to a subtask whose parent issue has an epic link to an Epic. For testing, I'm just applying this template to a add-comment post function. I've tried this against the 'current issue' and 'parent issue of the current subtask' in the issues to operate on 'Target Issue' dropdown but same result.

{{ issue | parentIssue | field("fields['Epic Link']") }}

Your template ran successfully

Result value:

When I run this against the same subtask issue, the epic link is visible on the parent issue.

{{issue|parentIssue|dump(2)}}

The ID for my epic link field is customfield_11440 but I can't figure out how to pass this instead of its name "epic link" as shown above. At this point I'm just trying to get the epic link to display to understand how these filters work. I can't get any of the filter examples on the linked page above to work.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2022

Hi @Paul Alexander ,

 can you try this :

{{ issue | parentIssue("customfield_11440") | field("fields.customfield_11440") }}

 However, using the Epic Link field is not recommended, as Atlassian will be retiring this field soon. 

Use this instead:

{{ issue | parentIssue("key") | epic("key") | field("key") }}
Paul Alexander
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2022

This pattern works, David, and I can apply this to other objects now to reach up to the parent and do things like increment a custom field. Thanks again. I couldn't figure out the syntax needed to allow the ID to work. Here they are side by side for comparison.

{{ issue | parentIssue("customfield_11440") | field("fields.customfield_11440") }}
{{ issue | parentIssue | field("fields['Epic Link']") }}

Interesting on losing the special 'epic link'. Here's an article from the mothership.

Deprecation of the Epic Link, Parent Link and other related fields in REST APIs and webhooks - Jira Development / Jira Cloud Announcements - The Atlassian Developer Community

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events