diff --git a/packages/nodes-base/nodes/Jira/IssueDescription.ts b/packages/nodes-base/nodes/Jira/IssueDescription.ts index ceb925c2d5183..cedba543f4d50 100644 --- a/packages/nodes-base/nodes/Jira/IssueDescription.ts +++ b/packages/nodes-base/nodes/Jira/IssueDescription.ts @@ -577,6 +577,13 @@ export const issueFields: INodeProperties[] = [ default: false, description: `Indicates whether fields in fields are referenced by keys rather than IDs. This parameter is useful where fields have been added by a connect app and a field's key may differ from its ID.`, }, + { + displayName: 'Friendly Field Names', + name: 'resolveCustomFields', + type: 'boolean', + default: false, + description: `Return the display value of fields instead of their ID`, + }, { displayName: 'Properties', name: 'properties', diff --git a/packages/nodes-base/nodes/Jira/Jira.node.ts b/packages/nodes-base/nodes/Jira/Jira.node.ts index 2a15cfba1803b..3d55018516650 100644 --- a/packages/nodes-base/nodes/Jira/Jira.node.ts +++ b/packages/nodes-base/nodes/Jira/Jira.node.ts @@ -653,6 +653,9 @@ export class Jira implements INodeType { if (additionalFields.expand) { qs.expand = additionalFields.expand as string; } + if (additionalFields.resolveCustomFields) { + qs.expand = `${qs.expand || ''},names`; + } if (additionalFields.properties) { qs.properties = additionalFields.properties as string; } @@ -660,6 +663,18 @@ export class Jira implements INodeType { qs.updateHistory = additionalFields.updateHistory as string; } responseData = await jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, qs); + if (additionalFields.resolveCustomFields) { + const mappedFields: IDataObject = {}; + for (const field of Object.keys(responseData.fields)) { + if (responseData.names[field] in mappedFields) { + // Duplicate fields, use original key + mappedFields[field] = responseData.fields[field]; + } else { + mappedFields[responseData.names[field] || field] = responseData.fields[field]; + } + } + responseData.fields = mappedFields; + } returnData.push(responseData); } }