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
Parmeshwar Bhore 1010011Parmeshwar Bhore 1010011 

Write a triggers and Test Classes.

1.Write a trigger to prevent duplicate Account creation with same name, , email and phone.
2.When lead is getting created add ''DR'' prefix to all leads names.
3.Write test class for both triggers
 
vishal-negandhivishal-negandhi

Hi Parmeshwar, 

You can implement all these features without actually writing code. 

1. Preventing Account duplicates - write a simple matching + duplicate rule on Account. 

Trailhead : https://trailhead.salesforce.com/content/learn/modules/sales_admin_duplicate_management

2. To add "DR" to all your leads during creation, you can write a flow / process builder with a field update action.

Hope this gives you the direction to start.

Best,

Vishal

SwethaSwetha (Salesforce Developers) 
HI Parameshwar,
For trigger to prevent duplicate Account creation check, https://www.syedtaha.com/salesforce-apex-triggers/salesforce-apex-trigger-to-prevent-duplicate-contacts-by-email-or-phone-number/897/ 
This link is for contact object, you will need to update to account object.

For 2nd check, https://stackoverflow.com/questions/32676117/adding-prefix-to-name-in-lead-using-triggers
Test class: https://developer.salesforce.com/forums/?id=9062I000000QuqqQAC

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Parmeshwar Bhore 1010011Parmeshwar Bhore 1010011
Thanks vishal, but i have write a trigger for that