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
SFAdmin5SFAdmin5 

simple delete trigger needed

Hi-

 

Is there a simple trigger that will delete an opportunity record when it's created with 3 fields not filled in?  This is a workaround fix to a known code issue that would be a lot quicker than fixing the original problem.

 

All I need is a trigger that deletes an opp after it's created when the opp was created with no value in three fields.  Thanks

sfdcfoxsfdcfox

Not as simple as it seems; you can't directly delete the object during its creation phase, so you would have to use a @future method to delete them after they have been committed to the database. Alternatively, consider a validation rule or validation trigger to prevent their creation outright. Modifying the original coding might be a better long-term solution.