I have this problem with triggers:
We have integration with our backoffice to receive leads. Unfortunately, we can't change this integration. It sends the leads when when it shouldn't.
insert if I find an existing duplicate lead I don't want to insert it. I do
lead.addError('This lead already exists in the system') and it works fine.
The problem is that I also need to create a task for this existing lead owner saying something along the lines of
user submitted the form again
This task is an important signal for the sellers and they want to be notified when that happens. The problem is that if I do
addError() in the trigger it rolls everything back and doesn't insert my task.
How can I prevent the lead from being inserted while creating a task at the same time?
Or is there a better way to approach this?