From a7c6f115b82c403f487f33ff162d302a7c21ccd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 1 Jun 2021 16:37:04 +0200 Subject: [PATCH] :zap: Fix custom fields for product operations --- packages/nodes-base/nodes/Zoho/GenericFunctions.ts | 2 ++ packages/nodes-base/nodes/Zoho/ZohoCrm.node.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/nodes-base/nodes/Zoho/GenericFunctions.ts b/packages/nodes-base/nodes/Zoho/GenericFunctions.ts index 29658e515d..9af5305750 100644 --- a/packages/nodes-base/nodes/Zoho/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoho/GenericFunctions.ts @@ -302,6 +302,8 @@ export const adjustVendorPayload = flow( adjustCustomFields, ); +export const adjustProductPayload = adjustCustomFields; + // ---------------------------------------- // helpers // ---------------------------------------- diff --git a/packages/nodes-base/nodes/Zoho/ZohoCrm.node.ts b/packages/nodes-base/nodes/Zoho/ZohoCrm.node.ts index a3fe658b89..500bec3a42 100644 --- a/packages/nodes-base/nodes/Zoho/ZohoCrm.node.ts +++ b/packages/nodes-base/nodes/Zoho/ZohoCrm.node.ts @@ -18,6 +18,7 @@ import { adjustInvoicePayload, adjustLeadPayload, adjustProductDetails, + adjustProductPayload, adjustPurchaseOrderPayload, adjustQuotePayload, adjustSalesOrderPayload, @@ -860,7 +861,7 @@ export class ZohoCrm implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; if (Object.keys(additionalFields).length) { - Object.assign(body, additionalFields); + Object.assign(body, adjustProductPayload(additionalFields)); } responseData = await zohoApiRequest.call(this, 'POST', '/products', body); @@ -913,7 +914,7 @@ export class ZohoCrm implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (Object.keys(updateFields).length) { - Object.assign(body, updateFields); + Object.assign(body, adjustProductPayload(updateFields)); } else { throwOnEmptyUpdate.call(this, resource); } @@ -937,7 +938,7 @@ export class ZohoCrm implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; if (Object.keys(additionalFields).length) { - Object.assign(body, additionalFields); + Object.assign(body, adjustProductPayload(additionalFields)); } responseData = await zohoApiRequest.call(this, 'POST', '/products/upsert', body);