• Zhen Zhang 22
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I just want to delete the opportunityshare record as below code. but when I delete it , it give me the error message as the title shows.(System.DmlException: Delete failed. First exception on row 0 with id 00t0U00000RD77SQAT; first error: INVALID_CROSS_REFERENCE_KEY, id does not exist: []). and I checked the result from database , I found the record has been deleted but new record inserted into the database(new record is the same to the old one except the record id).
Anyone who has ever met this kind error before? I would appreciate if anyone can help me . Really thanks a lot.


List<OpportunityShare> oppShareListDel = [SELECT id from OpportunityShare where OpportunityId in: oppIdListForShareDel and Rowcause = 'Manual' and userorgroupid in: oppUserOrGroupIdListAll];
 try{
          delete oppShareListDel;
 }catch(Exception excep){
          System.debug('error aaa:::  '+excep);
  }                   
I just want to delete the opportunityshare record as below code. but when I delete it , it give me the error message as the title shows.(System.DmlException: Delete failed. First exception on row 0 with id 00t0U00000RD77SQAT; first error: INVALID_CROSS_REFERENCE_KEY, id does not exist: []). and I checked the result from database , I found the record has been deleted but new record inserted into the database(new record is the same to the old one except the record id).
Anyone who has ever met this kind error before? I would appreciate if anyone can help me . Really thanks a lot.


List<OpportunityShare> oppShareListDel = [SELECT id from OpportunityShare where OpportunityId in: oppIdListForShareDel and Rowcause = 'Manual' and userorgroupid in: oppUserOrGroupIdListAll];
 try{
          delete oppShareListDel;
 }catch(Exception excep){
          System.debug('error aaa:::  '+excep);
  }