Skip to main content

Parent assignee field

This Scripted User Field shows who the work item's parent is assigned to. It's empty when the work item has no parent, or when the parent is unassigned.

Applies to: Script Master for Jira Β· Cloud

The script makes two requests: one for the parent's ID, and one for the parent's assignee. A User field needs an object with an accountId, and null leaves it empty.

const itemResponse = await api.asApp().requestJira(route`/rest/api/3/issue/${payload.issue.id}?fields=parent`);
const item = await itemResponse.json();

const parentId = item.fields?.parent?.id;
if (!parentId) return null;

const parentResponse = await api.asApp().requestJira(route`/rest/api/3/issue/${parentId}?fields=assignee`);
const parent = await parentResponse.json();

const accountId = parent.fields?.assignee?.accountId;
return accountId ? { accountId } : null;