mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
fix(Hubspot Node): Fix loading of Contacts (#3426)
This commit is contained in:
parent
9bbe88f462
commit
f02421b5f3
|
@ -911,12 +911,16 @@ export class Hubspot implements INodeType {
|
|||
const returnData: INodePropertyOptions[] = [];
|
||||
const endpoint = '/contacts/v1/lists/all/contacts/all';
|
||||
const contacts = await hubspotApiRequestAllItems.call(this, 'contacts', 'GET', endpoint);
|
||||
|
||||
for (const contact of contacts) {
|
||||
const contactName = `${contact.properties.firstname.value} ${contact.properties.lastname.value}`;
|
||||
const firstName = contact.properties?.firstname?.value || '';
|
||||
const lastName = contact.properties?.lastname?.value || '';
|
||||
const contactName = `${firstName} ${lastName}`;
|
||||
const contactId = contact.vid;
|
||||
returnData.push({
|
||||
name: contactName,
|
||||
value: contactId,
|
||||
description: `Contact VID: ${contactId}`,
|
||||
});
|
||||
}
|
||||
return returnData.sort((a, b) => a.name < b.name ? 0 : 1);
|
||||
|
|
Loading…
Reference in a new issue