• SFDC-IS2
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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());

}