Skip to content

Commit

Permalink
✨ Add option to use Jira field display names
Browse files Browse the repository at this point in the history
  • Loading branch information
pemontto committed Nov 4, 2021
1 parent 2125beb commit 77fe2e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/nodes-base/nodes/Jira/IssueDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,13 @@ export const issueFields = [
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',
Expand Down
14 changes: 14 additions & 0 deletions packages/nodes-base/nodes/Jira/Jira.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,27 @@ 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;
}
if (additionalFields.updateHistory) {
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];
}
mappedFields[responseData.names[field] || field] = responseData.fields[field];
}
responseData.fields = mappedFields;
}
returnData.push(responseData);
}
}
Expand Down

0 comments on commit 77fe2e5

Please sign in to comment.