rakesh
rakesh

Reputation: 23

Sharing file uploaded by community user with user with salesforce profile

I'm trying to share a file uploaded by a community user with a Salesforce profile. On file upload, I'm trying to create a content document link. On execution I'm getting this error - You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is needed.

I'm not sure which permission I'm missing on the profile of the user, because if change the profile of the user to the system admin same code is working and the file gets shared with the user.

Upvotes: 0

Views: 1441

Answers (1)

eyescream
eyescream

Reputation: 19637

Can the community user see this internal user in the community? Like maybe they can see Chatter posts or community user can see OK the "last modified by: [internal guy]" on a page layout, click that link OK?

I suspect your setup -> Sharing Settings are at play. On the Org-Wide Defaults row for user, what does it say in "Default External Access" column? "Private"? Below the table - is "Portal user Visibility" checked? (Maybe the user you want to target isn't a member of the community, you'd need to check community administration page). Maybe you have sharing rule on User to make sure they can be seen?

Sharing would be the proper place to check and fix, either across the board (all portal users to be able to see all internal users? some roles?) or record specific you could try with "Sharing Sets".

A "dirty but gets the job done" trick would be to mark the apex class "without sharing"...

Upvotes: 0

Related Questions