Website: update contacts when users subscribe to Fleet Premium (#22004)

Closes: #21921

Changes:
- Updated `save-biling-info-and-subscribe` to update CRM records in the
background when users purchase a self-service license.
This commit is contained in:
Eric 2024-09-12 17:17:52 -05:00 committed by GitHub
parent cc8134af76
commit c8149fa5e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -162,6 +162,22 @@ module.exports = {
}
});
let todayOn = new Date();
let isoTimestampForDescription = todayOn.toISOString();
sails.helpers.salesforce.updateOrCreateContactAndAccount.with({
emailAddress: this.req.me.emailAddress,
firstName: this.req.me.firstName,
lastName: this.req.me.lastName,
organization: this.req.me.organization,
description: `Purchased a self-service Fleet Premium license on ${isoTimestampForDescription.split('T')[0]} for ${quoteRecord.numberOfHosts} host${quoteRecord.numberOfHosts > 1 ? 's' : ''}.`
}).exec((err)=>{
if(err){
sails.log.warn(`Background task failed: When a user (email: ${this.req.me.emailAddress} purchased a self-service Fleet premium subscription, a Contact and Account record could not be created/updated in the CRM.`, err);
}
return;
});
}