Skip to content

Commit

Permalink
fix(Hubspot Node): Fix loading of Contacts (#3426)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency authored Jun 3, 2022
1 parent 9bbe88f commit f02421b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/nodes-base/nodes/Hubspot/Hubspot.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f02421b

Please sign in to comment.