Have you ever got any requirement similar to below and if yes, here is a simple way to achieve it.
Requirement: On creation of a new Sales Order record, Sales Rep wants to have feature, which will allow them to choose a contact from all contact lists(of that particular Customer) to whom email will be sent addressing the Contact Name with some other Contacts as CC instead of sending email to Customer(as a Company) with addressing Company Name.
Current Feature: Currently they are sending to customer(as a company) company email addressing Company name. And there is no option to select other contacts for choosing as CC.
How to achieve it???
Step 1: Create a custom field called Primary Contact which is a List/Record of Type “Contact”. In the field record set the Sourcing as “Parent equals Customer” so that the Primary Contact List will contain only the contacts belongs to that customer only.
Step 2: Create a custom field “Primary Contact Email” of type “Email Address” which will hold the contact email when Primary contact field will be selected with a contact.
Step 3: Create a custom field “Primary Contact Name” of type “Free-from-text” which will hold the contact name when Primary contact field will be selected with a contact.
Step 4: Create a “Multiselect” custom field of type “Contact“called “Secondary Contact List” where user can select multiple Contacts. In the field record set the Sourcing as “Parent equals Customer” so that the Primary Contact List will contain only the contacts belongs to that customer only.
Step 5: Create a “Text Area” custom field called “Secondary Contact Emails” which will hold the email address lists respective to selection of contact for CC list.
Step 6: Create a client script for Sales Order and in the field change event, write code for Primary Contact and Secondary Contact List field change, get respective emails and Contact Name(for Primary Contact). Deploy the script and test for any Sales Order, if on selection of Primary Contact and Secondary contact, respective emails and contact name is populated or not.
Now use the emails and contact name while sending emails.
Hope this small tip will help you 🙂