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

Keep trigger from inserting record

What is the best way to keep an object from actually being inserted using triggers? I have a custom helper object that I do not need/want any records created for it.


Why not do this just using permissions on the object?


Visit your security Profiles and all the objects, custom and standard are listed there with their CRUD permissions.  Just disallow creation.



If you *must* do this with a trigger for some reason I can't fathom, I'd think you could write a before-insert trigger on the object which just does a and thus blows away all the records in the list before they are actually created.


However, security is a better way to go, followed perhaps by leaving security alone and removing the "New" button from all page layouts. (which may not be sufficient to your needs.).


Best, Steve.