mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 04:47: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;
|
||||
}
|
||||
|
||||
|
||||
// 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 = [
|
||||
'contact.propertyChange',
|
||||
'company.propertyChange',
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
clean,
|
||||
hubspotApiRequest,
|
||||
hubspotApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
@ -2169,6 +2170,7 @@ export class Hubspot implements INodeType {
|
|||
Object.assign(body, { legalConsentOptions: { legitimateInterest: legitimateInteres } });
|
||||
}
|
||||
if (context) {
|
||||
clean(context);
|
||||
Object.assign(body, { context });
|
||||
}
|
||||
const uri = `https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`;
|
||||
|
|
Loading…
Reference in a new issue