I have written one trigger which makes file private on the creation and has another trigger which shares the file access to a public group, but the second trigger is not working since, when I try to enter public group id in LinkedEntityId it gives "field_integrity_exception id value of incorrect type" error. Please help if you have faced a similar problem before.


Share Files with Groups

Share files in Chatter with public or private groups so that members of the groups can view and download the files from their feed.

Public Groups (under Setup | Users) are entirely different than the Groups (linked to Chatter) to which files can be loaded. The Public Groups exist so that various Sharing rules can be created for specific Users.

So, You can share the file with Chatter groups but not with the Public groups.

consider creating a public link or making the file public by posting it to your feed if you want to share with the public group.

You can see the difference On UI. Go to any Files-->files sharing setting-->share with groups

it will give you only chatter groups to share with, Not the public groups. That's why you are getting field_integrity_exception id value of incorrect type error.

References:- https://help.salesforce.com/articleView?err=1&id=collab_files_sharing_groups.htm&type=5

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.