diff --git a/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts b/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts index df1eeb69e9..3f652ecf5c 100644 --- a/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts +++ b/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts @@ -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);