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
AdiiAdii 

Trigger Scenerio

Write a Trigger to create contact whenever the user is created. If any account matches with the email domain of the user
then that contact must be created under that account else create contact under a new account
ANUTEJANUTEJ (Salesforce Developers) 
Hi Adii,

Are you facing any issue while implementing the scenario?

You could follow below steps while implementing:

>>Create a trigger on user before insert.
>> get the emails of the accounts and add the domains to a set so that they are not repeated.
>> Check the set and if the domain is not present in the current list of contact details then create a new one or if there is one already you could create a new one under that contact.

I hope this helps, in case if this comes handy can you please choose this as best answer so that it can be used by others in the future.

Regards,
Anutej