mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-04 22:33:31 +08:00
* Move lwr site SKILL.md * Move bootstrap-template-byo-lwr.md * Move configure-content-brandingSet.md * Move configure-content-route.md * Move configure-content-themeLayout.md * Move configure-content-view.md * Move configure-guest-sharing-rules.md * Move handle-component-and-region-ids.md * Move handle-ui-components.md * Create react site SKILL.md * Create configure-metadata-custom-site.md * Create configure-metadata-digital-experience-bundle.md * Create configure-metadata-digital-experience-config.md * Create configure-metadata-digital-experience.md * Create configure-metadata-network.md --------- Co-authored-by: Hemant Singh Bisht <hsinghbisht@salesforce.com>
43 lines
1.7 KiB
Markdown
43 lines
1.7 KiB
Markdown
# Guest User Sharing Rules (Public Sites Only)
|
|
|
|
**Use when** the user explicitly wants to make the site **public** (accessible to unauthenticated visitors). If the site is private/login-required, guest sharing rules are not needed.
|
|
If sharingRules metadata is not available locally in force-app/main/default/sharingRules, retrieve it from the org before creating new rules.
|
|
|
|
## Retrieve Full SharingRules Schema
|
|
|
|
Use the metadata MCP tool with metadataType "SharingRules" to retrieve schema.
|
|
|
|
## XML Example
|
|
|
|
```xml
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
<sharingGuestRules>
|
|
<fullName>ShareAccountsWithSiteGuest</fullName>
|
|
<accessLevel>Read</accessLevel>
|
|
<includeHVUOwnedRecords>false</includeHVUOwnedRecords>
|
|
<label>Share Accounts With Site Guest</label>
|
|
<sharedTo>
|
|
<guestUser>[site Guest User's CommunityNickanme]</guestUser>
|
|
</sharedTo>
|
|
<criteriaItems>
|
|
<field>Name</field>
|
|
<operation>notEqual</operation>
|
|
<value>null</value>
|
|
</criteriaItems>
|
|
</sharingGuestRules>
|
|
</SharingRules>
|
|
```
|
|
|
|
## Critical Requirements
|
|
|
|
1. **SharedTo Element**: Must use `<guestUser>{site Guest User's CommunityNickanme}</guestUser>` (not URL path prefix).
|
|
2. **includeHVUOwnedRecords**: Required field. Set to `false` unless records owned by high-volume site users should be included.
|
|
3. **One XML file per object**: Put all rules for a given object in one file. Do not create additional.
|
|
|
|
## Common Mistakes
|
|
|
|
- Using `<role>` or `<group>` instead of `<guestUser>` in sharedTo
|
|
- Omitting the required `includeHVUOwnedRecords` field
|
|
- Using `includeRecordsOwnedByAll` (that's for `sharingCriteriaRules`, not guest rules)
|