mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
🐛 Fix issue loading custom fields on Salesforce Node (#1654)
This commit is contained in:
parent
db5bf69fd3
commit
fbc11080c7
|
@ -171,7 +171,7 @@ export const accountFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
@ -426,7 +426,7 @@ export const accountFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
|
|
@ -152,7 +152,7 @@ export const contactFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
@ -441,7 +441,7 @@ export const contactFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
|
|
@ -157,7 +157,7 @@ export const leadFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
@ -408,7 +408,7 @@ export const leadFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
|
|
@ -185,7 +185,7 @@ export const opportunityFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
@ -381,7 +381,7 @@ export const opportunityFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
|
|
@ -322,10 +322,11 @@ export class Salesforce implements INodeType {
|
||||||
},
|
},
|
||||||
// Get all the lead custom fields to display them to user so that he can
|
// Get all the lead custom fields to display them to user so that he can
|
||||||
// select them easily
|
// select them easily
|
||||||
async getLeadCustomFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getCustomFields(this: ILoadOptionsFunctions): Promise < INodePropertyOptions[] > {
|
||||||
const returnData: 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
|
// 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) {
|
for (const field of fields) {
|
||||||
if (field.custom === true) {
|
if (field.custom === true) {
|
||||||
|
|
|
@ -165,7 +165,7 @@ export const taskFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
@ -517,7 +517,7 @@ export const taskFields = [
|
||||||
name: 'fieldId',
|
name: 'fieldId',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
loadOptionsMethod: 'getLeadCustomFields',
|
loadOptionsMethod: 'getCustomFields',
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The ID of the field to add custom field to.',
|
description: 'The ID of the field to add custom field to.',
|
||||||
|
|
Loading…
Reference in a new issue