+ Start a Discussion

simple delete trigger needed



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


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.