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
Amrit Singh 27Amrit Singh 27 

Automatically Delete Leads based on an email pattern

We have deployed an automatic lead generation tool to create leads for checking website downtime. The leads are created with a random email address that begins with "ghostinspector+XXXXX@yahoo.com".
How can I create some sort of a trigger to automatically delete those records because they are increasing our leads counts and conversion rates.
I have read something about apex triggers, but have no idea how to do it. Can you guide to the right direction. We use Salesforce classic if that matters.
Thanks
AbhishekAbhishek (Salesforce Developers) 
The feature you are requesting is still in Idea Face,

https://trailblazer.salesforce.com/ideaView?id=08730000000Bp2Y


For further reference, you can check this too,

https://help.salesforce.com/articleView?id=pardot_crm_deleted.htm&type=5


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
vishal-negandhivishal-negandhi

Hi Amrit, 

I would just add a validation rule that will not let the lead to be created in first place. 

And getting a custom validation exception would still mean that your automatic lead generation went through and website is not down.