• RAJASEKARAN Bhuvaneshwari
  • 0 Points
  • Member since 2021

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
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];
          delete oppShareListDel;
 }catch(Exception excep){
          System.debug('error aaa:::  '+excep);