Email Author for Salesforce Lightning Experience
In my case, I was trying to migrate a Salesforce instance to lightning when I came across this problem and decided to create a lightning component to accomplish this.
This is what the component looks like:
The functionality of the component is very similar to the Salesforce classic email author. Email templates can be selected, the “From” can be set to the current logged in user or any available organization wide email addresses, cc, bcc and additional to values can be entered either as email addresses or multiple contacts can be selected, etc.
The component implements lightning:isUrlAddressable so that it can be accessed from other lightning components using lightning:navigation as follows:
<!-- calling component --> <lightning:navigation aura_id="navService"/>
As you can see, this sample code populates some of the fields of the email author.
The complete set of values that can be populated are as follows:
templateId – id of email template to use
format – ‘Text’ or ‘HTML’
from – running user’s User Id OR organization wide email address Id
to – Contact Id
relatedTo – API name of SObject
relatedToRecord – Id of record of the relatedTo SObject
additionalTo – list if email addresses separated by semicolon (eg. ‘firstname.lastname@example.org;email@example.com’)
cc – list if email addresses separated by semicolon
bcc – list if email addresses separated by semicolon
useSignature – Boolean (true or false)
subject – String for subject of email
body – String for body of email (if a template is specified, this will be overridden with the body from the template)
lstFiles – JSON stringified list of Ids of Attachments or Content Documents
Please comment below to let us know how you like this component.