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
Sandesh D GanjareSandesh D Ganjare 

How to stop inserting of record?

hi,
If u have taken leave on certain date and then again applied on the same date then your application will not be submitted.
how I will do that one.
please Help.
Shyama B SShyama B S
Hi Sandesh,

You can check the below link where a similar question was asked.
https://developer.salesforce.com/forums/?id=906F0000000BVJFIA4

To know more about triggers and Trigger.Error, the below link can give you an intro:
https://developer.salesforce.com/trailhead/force_com_dev_beginner/apex_triggers/apex_triggers_intro

Thanks,
Shyama
Amit Chaudhary 8Amit Chaudhary 8
Please try below code. I hope that will help u
trigger ContactTrigger on Contact(before insert)
{
for(Contact cont : trigger.new)
{
	if(cont.lastName == 'Test')
	{
      cont.addError('Please enter valid LastName');
	}  
}
}
Please let us know if this will help you

Thanks
Amit Chaudhary