2

I am trying to share a record of a custom object using an apex trigger.

When trying to give the access level "All", an exception is thrown :

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_ACCESS_LEVEL.

Question :

  • Can we give "delete" access by sharing record using apex ?
  • Is there an alternative ?

Thank you.

3

The doc is quite explicit that All may only be used by Force.com Managed Sharing

The All access level can only be used by Force.com managed sharing.

You are using Apex Managed Sharing - that is different from Force.com Managed Sharing

The distinctions are covered here

and summarized below:

Force.com Managed Sharing has three components:

  • Record Ownership
  • Role Hierarchy
  • Sharing Rules (these are the sharing rules you set in the Force.com Setup UI)

User Managed Sharing - the Share button on the record

Apex Managed Sharing (what you are doing) - only Read and Edit may be used

This is all covered in another answer here as well

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.