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
AwaraMohanAwaraMohan 

How do i prevent a record from insert without raising exception or addError

How do i prevent a record from insert without raising exception or addError

@anilbathula@@anilbathula@

Hi AwaraMohan

 

In ur class or trigger when ur inserting a record .

Put ur insert operation in a if condition and check for that condition.

If that condition is true then insert else no.

 

Just like this:-

 if(Contact.LastName!=null){   
          insert contact;  
        }  

And dont add else condition.

 

Thanks

Anil.B