mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
🐛 Fix issue when sending context parameter to Hubspot (#2035)
This commit is contained in:
parent
47fbd5e762
commit
afff86d9ae
|
@ -91,6 +91,17 @@ export function validateJSON(json: string | undefined): any { // tslint:disable-
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// tslint:disable-next-line: no-any
|
||||||
|
export function clean(obj: any) {
|
||||||
|
for (const propName in obj) {
|
||||||
|
if (obj[propName] === null || obj[propName] === undefined || obj[propName] === '') {
|
||||||
|
delete obj[propName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
export const propertyEvents = [
|
export const propertyEvents = [
|
||||||
'contact.propertyChange',
|
'contact.propertyChange',
|
||||||
'company.propertyChange',
|
'company.propertyChange',
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
clean,
|
||||||
hubspotApiRequest,
|
hubspotApiRequest,
|
||||||
hubspotApiRequestAllItems,
|
hubspotApiRequestAllItems,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
@ -2169,6 +2170,7 @@ export class Hubspot implements INodeType {
|
||||||
Object.assign(body, { legalConsentOptions: { legitimateInterest: legitimateInteres } });
|
Object.assign(body, { legalConsentOptions: { legitimateInterest: legitimateInteres } });
|
||||||
}
|
}
|
||||||
if (context) {
|
if (context) {
|
||||||
|
clean(context);
|
||||||
Object.assign(body, { context });
|
Object.assign(body, { context });
|
||||||
}
|
}
|
||||||
const uri = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`;
|
const uri = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`;
|
||||||
|
|
Loading…
Reference in a new issue