From 2f6bab36b2809af70be5c6774f92297ea8ea453d Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 30 Jan 2020 11:45:50 -0800 Subject: [PATCH] :zap: Add email field to Mautic-Node --- .../nodes/Mautic/ContactDescription.ts | 34 +++++++++++++++++++ .../nodes-base/nodes/Mautic/Mautic.node.ts | 19 +++++------ 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/packages/nodes-base/nodes/Mautic/ContactDescription.ts b/packages/nodes-base/nodes/Mautic/ContactDescription.ts index 01b164d8e5..b9eb9b0f42 100644 --- a/packages/nodes-base/nodes/Mautic/ContactDescription.ts +++ b/packages/nodes-base/nodes/Mautic/ContactDescription.ts @@ -66,6 +66,26 @@ export const contactFields = [ }, }, }, + { + displayName: 'Email', + name: 'email', + type: 'string', + displayOptions: { + show: { + resource: [ + 'contact', + ], + operation: [ + 'create', + ], + jsonParameters: [ + false, + ] + }, + }, + default: '', + description: 'Email address of the contact.', + }, { displayName: 'First Name', name: 'firstName', @@ -298,6 +318,20 @@ export const contactFields = [ default: '', description: 'Contact parameters', }, + { + displayName: 'Email', + name: 'email', + type: 'string', + displayOptions: { + show: { + '/jsonParameters': [ + false, + ], + }, + }, + default: '', + description: 'Email address of the contact.', + }, { displayName: 'First Name', name: 'firstName', diff --git a/packages/nodes-base/nodes/Mautic/Mautic.node.ts b/packages/nodes-base/nodes/Mautic/Mautic.node.ts index e8e2a69c09..15971e2116 100644 --- a/packages/nodes-base/nodes/Mautic/Mautic.node.ts +++ b/packages/nodes-base/nodes/Mautic/Mautic.node.ts @@ -106,16 +106,12 @@ export class Mautic implements INodeType { const jsonActive = this.getNodeParameter('jsonParameters', i) as boolean; let body: IDataObject = {}; if (!jsonActive) { - const firstName = this.getNodeParameter('firstName', i) as string; - const lastName = this.getNodeParameter('lastName', i) as string; - const company = this.getNodeParameter('company', i) as string; - const position = this.getNodeParameter('position', i) as string; - const title = this.getNodeParameter('title', i) as string; - body.firstname = firstName; - body.lastname = lastName; - body.company = company; - body.position = position; - body.title = title; + body.email = this.getNodeParameter('email', i) as string; + body.firstname = this.getNodeParameter('firstName', i) as string; + body.lastname = this.getNodeParameter('lastName', i) as string; + body.company = this.getNodeParameter('company', i) as string; + body.position = this.getNodeParameter('position', i) as string; + body.title = this.getNodeParameter('title', i) as string; } else { const json = validateJSON(this.getNodeParameter('bodyJson', i) as string); if (json !== undefined) { @@ -145,6 +141,9 @@ export class Mautic implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const contactId = this.getNodeParameter('contactId', i) as string; let body: IDataObject = {}; + if (updateFields.email) { + body.email = updateFields.email as string; + } if (updateFields.firstName) { body.firstname = updateFields.firstName as string; }