I am trying record sharing through apex. But when i am giving sharing setting to Customer Community User it is throwing this exception

FIELD_INTEGRITY_EXCEPTION, field integrity exception: unknown (invalid user or group: 00528000002WuKu):

So how can i Share records for Community User. I am having License Customer Community and I have created one Custom Profile called Hudson Changes


1 Answer 1


Customer Communities users do not have access to the full sharing model and therefore can't be added on a __Share record. The only way to share a record with a Customer Communities user is through Sharing Sets and Sharing Groups.


  • Ratan is right, and the workaround we used to get more flexibility than sharing sets and sharing groups was to set the records to be generally hidden from community users, then implement Visualforce Controllers "without sharing" which could serve up the records that we wanted to share with Apex Sharing Rules. Tedious, but effective if you don't have too many pages to worry about.
    – Aidan
    Commented Feb 15, 2016 at 14:51

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