You need to sign in to do that
Don't have an account?
Force.com
Unable to set the contact id for contactShare
Hello,
I am developing a trigger that will give access to certain contact records that will meet some criteria. I need to update and insert a ContactShare object for the same. However I am getting a compilation error.
Error: Compile Error: Field is not writeable: ContactShare.ContactId at line 8 column 9
trigger Share_Contact_For_Account on Contact (after insert, after update) { for (Contact c : Trigger.new) { ContactShare cs = new ContactShare(); cs.ContactId = c.Id; cs.ContactAccessLevel = 'Edit'; } }
Thanks
Change line#8 to:
You cannot do it because contactShare.contactId is not writable.To clarify this try following examples.
Not working(Not Editablr)
but following working(Editable)
Note:
sforce_api_objects_contactshare.htm
ContactShare object contactId not writable???
-Suresh