2

In my Org. OWD setting for Account Object is Private and for Contact it is Controlled By Parent. So whenever I want to share particular record I am creating an Object of ContactShare and try to update fields of contactShare I am getting following error.

Error: ContactID field is not writeable for SObject:ContactShare

and if I change the OWD for Contact to Private then everything is working flawless.

So Please Help me to resolve this error. and Yes I cannot change OWD to private.

1 Answer 1

2

The Controlled by Parent sharing setting for Organization Wide Defaults on objects means that you plan to defer any sharing of records in this object to the shared parent records.

When doing so, the ContactShare table still exists, and ostensibly is still populated by the system for the purpose of query optimization, however any sharing done by the us (manual sharing, Apex managed sharing, assigning of ownership, roles, territories) is disabled.

You are undoubtedly running into this.

In other words, you will not be able to directly populate ContactShare with Apex code without choosing some other option besides Controlled by Parent.

At best you can share the Account parent with that user.

But if you have one requirement in your business that states the Account should drive sharing, and another that states some Contact records should be shared independent of Account access, this becomes a Business Analysis problem.

Controlled By Parent might be better labeled as "Always Controlled by Parent". That clearly isn't what your business is asking for.

Your options are:

  • Live with Always Controlled By Parent
  • Switch Contact to Private and begin to implement different controls around the sharing model to ensure that the right contacts are seen by the right people.
2
  • Thanks for sharing this knowledge. So, it seems there are no workaround for my problem. Sad! but at least I get to know about the conclusion. Mar 5, 2015 at 11:59
  • What if I have few contacts which doesn't belong to any account and I want to share only those?? Coz I don't want to change OWD as Private for very few contact which would definitely affect rest of the contacts also. Mar 5, 2015 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .