During enrollment process our community user signs some documents/agreements which are saved as attachments on contact object (community contact representing the current user). And now on community profile page we need to display list of these attachments with the ability to view/download signed documents. Currently we are fighting with "not enough permissions" exception when follow well-known approach to work with attachments, i.e. URLFOR(...)

At the community profile level contact permissions is set as Read/Write. Sharing Settings at the system level is set to Private.

So far I've tried to create contact sharing rules as through Apex (ContactShare), as through web UI to grant edit permission to contact data. Permission has been granted but user still can not download attachments, again "not enough permissions" error.

Is there anything I'm missing here? Why even having edit permission to that specific contact record user can not access attachments linked to it from the community?

Any help would be appreciated. Thanks in advance.

  • I don't believe sharing of attachments propagate with the record to a community. You'll likely also need to share the attachments too. Read-only should be sufficient. It sounds like you have a Community Plus license. Create the Sharing for the Documents that are Attached too. – crmprogdev Dec 8 '16 at 12:58
  • That's a challenge. There is no way to create sharing specifically for attachments in salesforce (there is no even AttachmentShare object). Permission level for attachments is determined by access user has to parent object, i.e. contact. – wesaw Dec 8 '16 at 14:02
  • I know that's the situation for Accounts. Perhaps it's a matter of the fact you've stored them on the Contact Object that's making this difficult for you. You are doing apex managed sharing, correct? It almost sounds as those these are "contracts" of a sort and need to be related records stored on a separate object which you can share individually. – crmprogdev Dec 8 '16 at 14:11
  • Another thought. Does your Community allow file downloads in general? If not, that could be the source of the permissions error. – crmprogdev Dec 8 '16 at 14:13
  • Yep, approach with attachments works if we switch from Contact to let's say Asset object. So there is no problem with the code. It's just something specific about Contact. And unfortunately we need attachments to be right on the contact, client doesn't like custom object approach etc. – wesaw Dec 9 '16 at 7:51

Your Answer

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

Browse other questions tagged or ask your own question.