I am totally lost on this, I am trying to delete an opportunity share record using dev console as well as workbench. I am unable to delete the record with Rowcause = "Implicit Child"

List<opportunityshare> oshare = [select id from opportunityshare where OpportunityId=:'006460000032bsR'];
//Trying to delete the first entry.
delete oshare[1];

System.DmlException: Delete failed. First exception on row 0 with id 00txxxxxxxxxxxxxxxxxxx; first error: INVALID_CROSS_REFERENCE_KEY, id does not exist: []

We have a custom account team structure and a trigger on this object inserts standard account team which later creates an oppty sharing insert.

Is there a way to delete the record with rowcause='Implicit child'?

enter image description here


Is there a way to delete the record with rowcause='Implicit child'?

No. The only share records you are free to insert/update/delete are those with a RowCause of "Manual" and, for custom objects, any RowCause that is a custom type used with Apex Managed Sharing.

  • How do i prevent the user from seeing the oppty then :..( – Rao Mar 10 '17 at 22:28
  • @Rao You'll need to make sure that whatever is causing the Implicit Child sharing to stop doing that. If I had to guess, I'd say that your code is probably setting OpportunityAccessLevel on the account to a value higher than None. – sfdcfox Mar 10 '17 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.