mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
⚡ Populate property and property with history when retrieving deals (Hubspot) (#2173)
* Fix hubspotApiRequestAllItems * amqplib version update * Add Hubspot Deals getAll properties & propertiesWithHistory dropdown * ⚡ Improvements to #2089 Co-authored-by: DeskYT <deskytube@gmail.com> Co-authored-by: DeskYT <54146274+DeskYT@users.noreply.github.com>
This commit is contained in:
parent
5de93a7db1
commit
6b6710439b
|
@ -447,8 +447,11 @@ export const dealFields = [
|
|||
{
|
||||
displayName: 'Properties',
|
||||
name: 'properties',
|
||||
type: 'string',
|
||||
default: '',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDealProperties',
|
||||
},
|
||||
default: [],
|
||||
description: `Used to include specific deal properties in the results.<br/>
|
||||
By default, the results will only include Deal ID and will not include the values for any properties for your Deals.<br/>
|
||||
Including this parameter will include the data for the specified property in the results.<br/>
|
||||
|
@ -457,11 +460,15 @@ export const dealFields = [
|
|||
{
|
||||
displayName: 'Properties With History',
|
||||
name: 'propertiesWithHistory',
|
||||
type: 'string',
|
||||
default: '',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getDealProperties',
|
||||
},
|
||||
default: [],
|
||||
description: `Works similarly to properties=, but this parameter will include the history for the specified property,<br/>
|
||||
instead of just including the current value. Use this parameter when you need the full history of changes to a property's value.`,
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
|
|
|
@ -2032,10 +2032,12 @@ export class Hubspot implements INodeType {
|
|||
qs.includeAssociations = filters.includeAssociations as boolean;
|
||||
}
|
||||
if (filters.properties) {
|
||||
qs.properties = (filters.properties as string).split(',');
|
||||
const properties = filters.properties as string | string[];
|
||||
qs.properties = (!Array.isArray(filters.properties)) ? (properties as string).split(',') : properties;
|
||||
}
|
||||
if (filters.propertiesWithHistory) {
|
||||
qs.propertiesWithHistory = (filters.propertiesWithHistory as string).split(',');
|
||||
const propertiesWithHistory = filters.propertiesWithHistory as string | string[];
|
||||
qs.propertiesWithHistory = (!Array.isArray(filters.propertiesWithHistory)) ? (propertiesWithHistory as string).split(',') : propertiesWithHistory;
|
||||
}
|
||||
const endpoint = `/deals/v1/deal/paged`;
|
||||
if (returnAll) {
|
||||
|
@ -2114,7 +2116,7 @@ export class Hubspot implements INodeType {
|
|||
if (returnAll) {
|
||||
|
||||
responseData = await hubspotApiRequestAllItems.call(this, 'results', 'POST', endpoint, body, qs);
|
||||
|
||||
|
||||
} else {
|
||||
body.limit = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await hubspotApiRequest.call(this, 'POST', endpoint, body, qs);
|
||||
|
|
Loading…
Reference in a new issue