diff --git a/packages/nodes-base/nodes/Salesforce/AccountDescription.ts b/packages/nodes-base/nodes/Salesforce/AccountDescription.ts index 35af86a2f..8399018e2 100644 --- a/packages/nodes-base/nodes/Salesforce/AccountDescription.ts +++ b/packages/nodes-base/nodes/Salesforce/AccountDescription.ts @@ -171,7 +171,7 @@ export const accountFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', @@ -426,7 +426,7 @@ export const accountFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', diff --git a/packages/nodes-base/nodes/Salesforce/ContactDescription.ts b/packages/nodes-base/nodes/Salesforce/ContactDescription.ts index aac14a6a7..68a9db746 100644 --- a/packages/nodes-base/nodes/Salesforce/ContactDescription.ts +++ b/packages/nodes-base/nodes/Salesforce/ContactDescription.ts @@ -152,7 +152,7 @@ export const contactFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', @@ -441,7 +441,7 @@ export const contactFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', diff --git a/packages/nodes-base/nodes/Salesforce/LeadDescription.ts b/packages/nodes-base/nodes/Salesforce/LeadDescription.ts index 402c39792..4f0c57d11 100644 --- a/packages/nodes-base/nodes/Salesforce/LeadDescription.ts +++ b/packages/nodes-base/nodes/Salesforce/LeadDescription.ts @@ -157,7 +157,7 @@ export const leadFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', @@ -408,7 +408,7 @@ export const leadFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', diff --git a/packages/nodes-base/nodes/Salesforce/OpportunityDescription.ts b/packages/nodes-base/nodes/Salesforce/OpportunityDescription.ts index 0529207a4..4a693954f 100644 --- a/packages/nodes-base/nodes/Salesforce/OpportunityDescription.ts +++ b/packages/nodes-base/nodes/Salesforce/OpportunityDescription.ts @@ -185,7 +185,7 @@ export const opportunityFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', @@ -381,7 +381,7 @@ export const opportunityFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', diff --git a/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts b/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts index 9cbe6ee2c..e558234f8 100644 --- a/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts +++ b/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts @@ -322,10 +322,11 @@ export class Salesforce implements INodeType { }, // Get all the lead custom fields to display them to user so that he can // select them easily - async getLeadCustomFields(this: ILoadOptionsFunctions): Promise { + async getCustomFields(this: ILoadOptionsFunctions): Promise < INodePropertyOptions[] > { const returnData: INodePropertyOptions[] = []; + const resource = this.getNodeParameter('resource', 0) as string; // TODO: find a way to filter this object to get just the lead sources instead of the whole object - const { fields } = await salesforceApiRequest.call(this, 'GET', '/sobjects/lead/describe'); + const { fields } = await salesforceApiRequest.call(this, 'GET', `/sobjects/${resource}/describe`); for (const field of fields) { if (field.custom === true) { diff --git a/packages/nodes-base/nodes/Salesforce/TaskDescription.ts b/packages/nodes-base/nodes/Salesforce/TaskDescription.ts index 2fb83f757..2cd2b3fd5 100644 --- a/packages/nodes-base/nodes/Salesforce/TaskDescription.ts +++ b/packages/nodes-base/nodes/Salesforce/TaskDescription.ts @@ -165,7 +165,7 @@ export const taskFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.', @@ -517,7 +517,7 @@ export const taskFields = [ name: 'fieldId', type: 'options', typeOptions: { - loadOptionsMethod: 'getLeadCustomFields', + loadOptionsMethod: 'getCustomFields', }, default: '', description: 'The ID of the field to add custom field to.',