function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amanda JonesAmanda Jones 

How to create a custom record sharing button on list view

Hello everyone,

I recently created a new user with very limited access in  our SF org. As a result I changed the permissions for one object (Donations) to private. It was always public before.

Everyone else still has full access to the records on that object, but for this one particular user, it appears that I now need to go in and grant access to each record (there are over 400) by clicking the sharing button.

I thought perhaps if the button were on the list view, I might be able to select several at once and then do a mass update to add the user and grant access to the records. However I am not quite sure how to go about it.

I tried a simple button with URL as the content source, but wasn't sure about the parameters to use for the record IDs to get the button to pull variable records. Here is the url when I click the sharing button:https://na12.salesforce.com/p/share/OppSharingEdit?parentId=(recordID)&retURL=%2Fp%2Fshare%2FOppSharingDetail%3FparentId%(recordID)

Or perhaps I should use a button with onclick javascript as the content source, but have no idea how to start writing the code for that.

Any ideas, guidance or help articles are much appreciated.

Thank you!

 
 
Amit Chaudhary 8Amit Chaudhary 8
Hi,
You can create on custom button and you can use Apex sharing for recors sharing. Please check below link for smple code.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm

Please let us know if his will help you

Thanks
Amit Chaudhary