function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saurabh Bisht 19Saurabh Bisht 19 

Using Trigger Design pattern and Trigger on Contact

when user create new conatct and fill email field as abc@gmail.com
firstly we want to extract the email domain name which we filled
as gmail.
then we check that domain name wegot gmail same name as in Account
record.
If it matches the any account so assign that domain to account name field
in Contact object.
if it doesnt match any account then show any error message.
AnkaiahAnkaiah (Salesforce Developers) 
Hi Saurabh,

refer the below link have similar kind of ask and modify the code as per your need.
https://salesforce.stackexchange.com/questions/70539/assign-account-to-contact-based-on-email-domain

If this helps, Please mark it as best answer.

Let me know if any help, required.

Thanks!!