I have a trigger on the Opportunity that fires BeforeInsert & BeforeUpdate. Among other things, one of the requirements of the trigger is that a specific field on the opportunity is updated if an OpportunityLineItem with a product family of X is deleted and a different field is updated if an OpportunityLineItem with a product family of Y is deleted.
SOQL cannot query deleted OpportunityLineItems. I looked at the Database.GetDeleted function, but that is throwing an unexpected error. Google isn't showing anything relevant.
So, is it possible to determine which (if any) OpportunityLineItem was deleted in a trigger on the Opportunity? I cannot use a trigger on the OpportunityLineItem.
Thank you!
OpportunityLineitem_Delete_Log__c
, (2) afterdelete trigger on OpportunityLineItem appends or smashes (depends on your appl logic)OpportunityLineitem_Delete_Log__c
perhaps as a JSON string of the relevant fields you want to examine; (3) After update Opportunity trigger examinesOpportunityLineitem_Delete_Log__c
and does what you need.