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
Will Jones 18Will Jones 18 

Unable to pull OpportunityContactRole deleted records

I am attempting to do a call out to an external server to notify it to remove a contact from an opportunity if it is removed from the contact role on the opportunity in Salesforce. However the query I am attempting to use does not return any records. I attempted to delete a contact from an Opportunity and when I check by debug log I see that my query does not ever return any record. I trigger the opportunity successfully when the opportunitycontactrole is edited/deleted but it doesn't return the record. Any suggestion?
 
trigger OCR on Opportunity (after insert, after update, after delete) {

List<OpportunityContactRole> ocr_list_del = [SELECT Id, OpportunityId, ContactId, Role, IsPrimary FROM OpportunityContactRole WHERE OpportunityId IN: Trigger.newmap.keyset() AND IsDeleted=true ALL ROWS];

SYSTEM.DEBUG('The OCR Delete List Size is ' + ocr_list_del.size());

}

 
adflintadflint
I am having the same issue, contacted support about this, will let you know what I hear.  Seems like OpportunityContactRole records skip the recycle bin.
SFDC-IS2SFDC-IS2
Any updates here? We have been able to use the IsDeleted flag for OCRs in the past and it looks like you can use the getDeleted methods via the api (so they don't always skip the recyle bin).

Is this a recent change?