Newer Version Available
Sample Custom Components for Outlook and Gmail Integration
Apply the Selected Email Context
Display Record Data Based On Recipients
In this example, the custom component displays account and opportunity information based on the email recipients’ email addresses. The component calls a JavaScript controller function, handlePeopleChange(), on initialization.
The Apex controller includes Aura-enabled methods that accept a list of emails as parameters. It queries the Contact and OpportunityContactRoles objects using SOQL and assigns the results to a List variable. You can also modify the example with your own custom objects.
On component initialization, this JavaScript controller calls the helper method, filterEmails(), which builds a list of email addresses from the available people.
The JavaScript controller then makes a call to the server to run the actions to display information. It calls the findOpportunityCloseDateTime method on the Apex controller to query the opportunities days until closing. It calls the findAccountAges method to query the accounts ages.
Once the server returns the values, it sets the appropriate values to display on the client side.
This helper function filters emails from objects.