From 5f5b7bb273912e0abb7b0e935c5ae28e05c51bfe Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 25 Nov 2024 14:58:25 -0600 Subject: [PATCH] Website: Update CRM helper to handle contacts with no stage. (#24143) Closes: https://github.com/fleetdm/confidential/issues/8975 Changes: - Updated the update-or-create-contact-and-account helper to only check the current stage value of a contact record if the value is set. --- .../salesforce/update-or-create-contact-and-account.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/api/helpers/salesforce/update-or-create-contact-and-account.js b/website/api/helpers/salesforce/update-or-create-contact-and-account.js index 0f2c26c965..5d0b24dcd5 100644 --- a/website/api/helpers/salesforce/update-or-create-contact-and-account.js +++ b/website/api/helpers/salesforce/update-or-create-contact-and-account.js @@ -161,8 +161,9 @@ module.exports = { delete valuesToSet.Intent_signals__c; } } - // Check the existing contact record's psychologicalStage. - if(psychologicalStage) { + + // Check the existing contact record's psychologicalStage (If it is set). + if(psychologicalStage && existingContactRecord.Stage__c !== null) { let recordsCurrentPsyStage = existingContactRecord.Stage__c; // Because each psychological stage starts with a number, we'll get the first character in the record's current psychological stage and the new psychological stage to make comparison easier. let psyStageStageNumberToChangeTo = Number(psychologicalStage[0]);