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:
Ricardo Espinoza 2021-09-05 08:35:16 -04:00 committed by GitHub
parent 5de93a7db1
commit 6b6710439b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -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.`,
},
],
},

View file

@ -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);