Apex Aide apexaide

Email Quick Action with a Pre-Email Screen and Lightning Record Picker in Lightning Web Component | Salesforce

www.salesforcebolt.com· ·Intermediate ·Developer ·3 min read
Summary

This content explains how to create a Salesforce Lightning Web Component quick action on the Account object that first presents a pre-email selection screen using a Lightning Record Picker. It enables users to pick a related Contact before redirecting to the standard Send Email quick action prefilled with the selected Contact's email address. The solution includes a complete LWC implementation with code snippets for the template, JavaScript logic, and metadata configuration. This pattern improves user experience by combining record selection and email composition into a streamlined UI flow.

Takeaways
  • Build a LWC quick action with a pre-email contact selection screen.
  • Use lightning-record-picker to filter related Contacts by AccountId.
  • Leverage NavigationMixin to invoke standard Send Email quick action.
  • Prepopulate email fields using encodeDefaultFieldValues with ToAddress.
  • Close the quick action screen after navigating to the email composer.

Hi there, in this blog you will be able to understand the scenario of having a Pre-Email screen and the code snippet of doing the same. If you are following my Videos/Blog then previously I had created a video on Send Email as Quick Action and the other one was on Lightning Record Picker . If you are new to this blog you can check the previous videos links below: 1. Send Email as Quick Action : https://youtu.be/PoaWHVuxlEE?si=x4aSNhZ6N50aaiiB 2. Lightning Record Picker : https://youtu.be/zZ1OJq5iHi4?si=tK6_ukRYAe_W_GXP Scenario : We need to create a Email Quick Action on Account object which should give us a list of related Contacts and user should be having option to pick the Contact and send the email. Solution : As a solution we will build a LWC Quick Action which will be having Lightning Record Picker as a Pre-Screen so that user can select the Contact. Once the Contact is selected we will redirect user to Email Composer with selected contact email.

Lightning Web Components[object Object]