---
title: "Accessing fields of a subtask or a parent"
canonical: "https://support.appfire.com/space/JMWE/461570859/Accessing%20fields%20of%20a%20subtask%20or%20a%20parent"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet accesses the fields of a subtask or a parent issue

### Logic

<span style="color: #172b4d">You cannot access all the sub-fields of a subtask or a parent using the "Sub-tasks" field </span>`{{ issue.fields['Sub-tasks'] }}`<span style="color: #172b4d"> or the "Parent" field </span>`{{issue.fields["Parent"] }}`<span style="color: #172b4d"> respectively. This is a</span><span style="color: #172b4d"> Jira Cloud limitation. It only returns a subset of fields of the issue in context and </span>*<span style="color: #172b4d">not all</span>*<span style="color: #172b4d"> the sub-fields. </span>

<span style="color: #333333">**To access the fields of a subtask**</span><span style="color: #333333">: Use the </span>`subtasks`<span style="color: #333333"> filter on the issue to get the subtasks. Access a subtask using the </span>`first/last/find/filter`<span style="color: #333333"> filter, whichever is applicable and then the </span>`field`<span style="color: #333333"> filter to access a field of the subtask</span>

**To access the fields of a parent issue:** Use the `parent` filter on the issue to get the parent of the issue and the `field` filter to access the fields of the parent issue.

### Snippet

To access a field of a subtask

```java
{{ issue | subtasks | <filter> | field("fields.<fieldId>") }}
```

or

```java
{{ issue | subtasks | <filter> | field("fields['<fieldName>']") }}
```

To access a field of a parent issue

```java
{{ issue | parentIssue | field("fields.<fieldId>") }}
```

or

```java
{{ issue | parentIssue | <filter> | field("fields['<fieldName>']") }}
```

### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Name of the field`> | Name of the field | `components` |
| `<filter>` | Filter to fetch a subtask | `last` |

Examples

<span style="color: #333333">The outcome of the code snippet is an issues' field value which can be used to </span>

- <span style="color: #333333">Set the field value of another issue</span>
- <span style="color: #333333">Compare the field value to a constant in a conditional execution statement</span>

**<span style="color: #333333">For example:</span>**<span style="color: #333333"> </span>

- Fetch the **Component/s** of the first subtask of the parent
  or
- Fetch the **Affects Version/s** of the last subtask of the parent
  or
- Fetch the **Assignee** of the first subtask reported by the current user
  or
- Fetch the **Assignee** of the parent
  or

### References

- [subtasks](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465373638) filter
- [parent](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465373638) filter
- [**Nunjucks documentation**](https://mozilla.github.io/nunjucks/templating.html)

### Related articles

> Macro (contentbylabel)

> Macro (details)
> 
> | **Related issues** |  |
> | --- | --- |