By using sharing sets now you can share the records with "Digital Experience" users (Customer or Partner) without specially write any apex code, sharing rules.
This give ability to share records based on the login user's matching account or contact.
For this you have to follow the following steps:
Create a lookup field of account/contact on the object which you want to share.
Create sharing set as following:
Go to setup, search Digital Experiences, open Settings.
Scroll down to the Sharing Sets related list.
Click on New button.
Fill Label, Sharing Set Name and Description.
Select profile(s) to whom you want to share the records.
Select Select Objects which you want to share.
Click on the Set Up link under Configure Access section.
Select Use field on which match the record should share, in our case we are selecting account.
Select Matches field of the object, in our case we are selecting Account__c.
Select Access Level Read Only or Read/Write.
Click on Update.
Click on Save.
Sharing set created, now you have to create some automation like workflow/flow/apex trigger to fill the lookup you have created in step 1. or You can manually fill the lookup with the "Digital Experience" user's account/contact.
Now Digital Experience user will see the records.
Comentários