fleet/website/api/controllers/deliver-deal-registration-submission.js
Eric da3ad28f4c
Website: add deal registration page (#20667)
Closes: #19531

Changes:
- Added a deal registration page at /deals
- Added a new email template: `email-deal-registration`
- Added a new action to send the deal registration form submission to
the email address set in the `sails.config.custom.
dealRegistrationContactEmailAddress` config variable
- Updated the HTML email preview page to support the new email template.
2024-07-25 13:12:08 -05:00

51 lines
1.6 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'Deliver deal registration submission',
description: 'Sends an email with the contents of a deal registration form submission',
inputs: {
submittersFirstName: {type: 'string'},
submittersLastName: {type: 'string'},
submittersEmailAddress: {type: 'string'},
submittersOrganization: {type: 'string'},
customersFirstName: {type: 'string'},
customersLastName: {type: 'string'},
customersEmailAddress: {type: 'string'},
linkedinUrl: {type: 'string', defaultsTo: 'N/A'},
customersOrganization: {type: 'string'},
customersCurrentMdm: {type: 'string', defaultsTo: 'N/A'},
otherMdmEvaluated: {type: 'string', defaultsTo: 'N/A'},
preferredHosting: {type: 'string', defaultsTo: 'N/A'},
expectedDealSize: {type: 'string'},
expectedCloseDate: {type: 'string'},
notes: {type: 'string', defaultsTo: 'N/A'},
},
exits: {
},
fn: async function (inputs) {
if(!sails.config.custom.dealRegistrationContactEmailAddress){
throw new Error('Missing config variable! Please set sails.config.custom.dealRegistrationContactEmailAddress to be the email address of the person who receives deal registration submissions.');
}
// send the information to the deal registration contact email address.
await sails.helpers.sendTemplateEmail.with({
to: sails.config.custom.dealRegistrationContactEmailAddress,
subject: 'New deal registration form submission',
template: 'email-deal-registration',
templateData: inputs,
});
// All done.
return;
}
};