Website: update values set by SF helpers. (leadSource » contactSource) (#21408)

Changes:
- Updated the `update-or-create-contact-and-account` helper to set a
"Contact source" on new contact records created.
- Updated everywhere where a lead source was being set to instead set a
contact source
This commit is contained in:
Eric 2024-08-19 15:42:49 -05:00 committed by GitHub
parent ce83b6d8e3
commit 05f9f5dd77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 14 additions and 14 deletions

View file

@ -75,7 +75,7 @@ module.exports = {
emailAddress: emailAddress,
firstName: firstName,
lastName: lastName,
leadSource: 'Website - Contact forms',
contactSource: 'Website - Contact forms',
description: `Sent a contact form message: ${message}`,
}).exec((err)=>{// Use .exec() to run the salesforce helpers in the background.
if(err) {

View file

@ -82,7 +82,7 @@ module.exports = {
organization: organization,
numberOfHosts: numberOfHosts,
primaryBuyingSituation: primaryBuyingSituation === 'eo-security' ? 'Endpoint operations - Security' : primaryBuyingSituation === 'eo-it' ? 'Endpoint operations - IT' : primaryBuyingSituation === 'mdm' ? 'Device management (MDM)' : primaryBuyingSituation === 'vm' ? 'Vulnerability management' : undefined,
leadSource: 'Website - Contact forms',
contactSource: 'Website - Contact forms',
leadDescription: `Submitted the "Talk to us" form and was taken to the Calendly page for the "Talk to us" event.`,
}).exec((err)=>{
if(err) {
@ -96,7 +96,7 @@ module.exports = {
lastName: lastName,
organization: organization,
primaryBuyingSituation: primaryBuyingSituation === 'eo-security' ? 'Endpoint operations - Security' : primaryBuyingSituation === 'eo-it' ? 'Endpoint operations - IT' : primaryBuyingSituation === 'mdm' ? 'Device management (MDM)' : primaryBuyingSituation === 'vm' ? 'Vulnerability management' : undefined,
leadSource: 'Website - Contact forms',
contactSource: 'Website - Contact forms',
description: `Submitted the "Talk to us" form and was taken to the Calendly page for the "Let\'s get you set up!" event.`,
}).exec((err)=>{
if(err) {

View file

@ -144,7 +144,7 @@ the account verification message.)`,
firstName: firstName,
lastName: lastName,
organization: organization,
leadSource: 'Website - Sign up'
contactSource: 'Website - Sign up'
}).exec((err)=>{
if(err){
sails.log.warn(`Background task failed: When a user (email: ${newEmailAddress} signed up for a fleetdm.com account, a Contact and Account record could not be created/updated in the CRM.`, err);

View file

@ -221,7 +221,7 @@ module.exports = {
primaryBuyingSituation: primaryBuyingSituation === 'eo-security' ? 'Endpoint operations - Security' : primaryBuyingSituation === 'eo-it' ? 'Endpoint operations - IT' : primaryBuyingSituation === 'mdm' ? 'Device management (MDM)' : primaryBuyingSituation === 'vm' ? 'Vulnerability management' : undefined,
organization: this.req.me.organization,
psychologicalStage,
leadSource: 'Website - Sign up',
contactSource: 'Website - Sign up',
}).exec((err)=>{
if(err){
sails.log.warn(`Background task failed: When a user (email: ${this.req.me.emailAddress} submitted a step of the get started questionnaire, a Contact and Account record could not be created/updated in the CRM.`, err);

View file

@ -35,7 +35,7 @@ module.exports = {
type: 'string',
description: 'A description of what this lead is about; e.g. a contact form message, or the size of t-shirt being requested.'
},
leadSource: {
contactSource: {
type: 'string',
required: true,
isIn: [
@ -58,7 +58,7 @@ module.exports = {
fn: async function ({emailAddress, linkedinUrl, firstName, lastName, organization, primaryBuyingSituation, psychologicalStage, leadSource, leadDescription, numberOfHosts}) {
fn: async function ({emailAddress, linkedinUrl, firstName, lastName, organization, primaryBuyingSituation, psychologicalStage, contactSource, leadDescription, numberOfHosts}) {
if(sails.config.environment !== 'production') {
sails.log('Skipping Salesforce integration...');
return;
@ -72,7 +72,7 @@ module.exports = {
linkedinUrl,
primaryBuyingSituation,
psychologicalStage,
leadSource,
contactSource,
description: leadDescription,
});
@ -80,7 +80,7 @@ module.exports = {
salesforceContactId: recordIds.salesforceContactId,
salesforceAccountId: recordIds.salesforceAccountId,
leadDescription,
leadSource,
leadSource: contactSource,
numberOfHosts,
});

View file

@ -30,7 +30,7 @@ module.exports = {
'6 - Has team buy-in'
]
},
leadSource: {
contactSource: {
type: 'string',
isIn: [
'Website - Contact forms',
@ -52,7 +52,7 @@ module.exports = {
},
fn: async function ({emailAddress, linkedinUrl, firstName, lastName, organization, primaryBuyingSituation, psychologicalStage, leadSource, description}) {
fn: async function ({emailAddress, linkedinUrl, firstName, lastName, organization, primaryBuyingSituation, psychologicalStage, contactSource, description}) {
// Return undefined if we're not running in a production environment.
if(sails.config.environment !== 'production') {
sails.log.verbose('Skipping Salesforce integration...');
@ -198,9 +198,9 @@ module.exports = {
// console.log('New account created!', salesforceAccountId);
}//fi
// Only add leadSource to valuesToSet if we're creating a new contact record.
if(leadSource) {
valuesToSet.LeadSource = leadSource;
// Only add contactSource to valuesToSet if we're creating a new contact record.
if(contactSource) {
valuesToSet.Contact_source__c = contactSource;// eslint-disable-line camelcase
}
// console.log(`creating new Contact record.`)
// Create a new Contact record for this person.