0

Wondering If we can get a list of records got ignored by Trigger add error method. We have a trigger which blocks the duplicates records coming into salesforce from Web to Case HTML Form using Trigger.add method. I was wondering if we can get a list how many cases got ignored as per logic compared to the cases already there in salesforce.

Any help?

1 Answer 1

1

Generally the caller can get this information by doing

Database.SaveResult[] srs = Database.insert(listOfCases, false);

But that doesn't apply in this situation, since the insert operation is not under your control. Your trigger would need to persist details about the cases that have been rejected to a Custom Setting (if you're just storing a count) or a Custom Object (to log details about the rejected Cases) to record those errors.

Once errors have been returned to the caller, those objects are gone, since they're not inserted or persisted in the database. Your only opportunity to record them is in the trigger itself.

1
  • Thanks, David. I had the same thought but just wanted to confirm. Commented Mar 29, 2018 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .