mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
Merge branch 'master' of github.com:n8n-io/n8n
This commit is contained in:
@@ -63,7 +63,7 @@ export class Hubspot implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'HubSpot',
|
||||
name: 'hubspot',
|
||||
icon: 'file:hubspot.png',
|
||||
icon: 'file:hubspot.svg',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
@@ -526,6 +526,26 @@ export class Hubspot implements INodeType {
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
|
||||
// Get all the company custom properties to display them to user so that he can
|
||||
// select them easily
|
||||
async getCompanyCustomProperties(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const endpoint = '/properties/v2/companies/properties';
|
||||
const properties = await hubspotApiRequest.call(this, 'GET', endpoint, {});
|
||||
for (const property of properties) {
|
||||
if (property.hubspotDefined === null) {
|
||||
const propertyName = property.label;
|
||||
const propertyId = property.name;
|
||||
returnData.push({
|
||||
name: propertyName,
|
||||
value: propertyId,
|
||||
});
|
||||
}
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* DEAL */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -1535,6 +1555,18 @@ export class Hubspot implements INodeType {
|
||||
value: additionalFields.yearFounded,
|
||||
});
|
||||
}
|
||||
if (additionalFields.customPropertiesUi) {
|
||||
const customProperties = (additionalFields.customPropertiesUi as IDataObject).customPropertiesValues as IDataObject[];
|
||||
|
||||
if (customProperties) {
|
||||
for (const customProperty of customProperties) {
|
||||
body.push({
|
||||
name: customProperty.property,
|
||||
value: customProperty.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const endpoint = '/companies/v2/companies';
|
||||
responseData = await hubspotApiRequest.call(this, 'POST', endpoint, { properties: body });
|
||||
}
|
||||
@@ -1747,6 +1779,18 @@ export class Hubspot implements INodeType {
|
||||
value: updateFields.yearFounded,
|
||||
});
|
||||
}
|
||||
if (updateFields.customPropertiesUi) {
|
||||
const customProperties = (updateFields.customPropertiesUi as IDataObject).customPropertiesValues as IDataObject[];
|
||||
|
||||
if (customProperties) {
|
||||
for (const customProperty of customProperties) {
|
||||
body.push({
|
||||
name: customProperty.property,
|
||||
value: customProperty.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const endpoint = `/companies/v2/companies/${companyId}`;
|
||||
responseData = await hubspotApiRequest.call(this, 'PUT', endpoint, { properties: body });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user