SharingGuestRule defines a rule that gives guest users Read access to records that meet specified criteria. Each rule is contained in the sharingGuestRules collection of an object's SharingRules metadata, alongside the object's other sharing rules.
The rule separates three decisions: which guest users receive access, which records meet the filter conditions, and whether records owned by high-volume community or site users are eligible. It inherits settings from SharingBaseRule, except accountSettings. Unlike some other sharing-rule types, it cannot grant Edit access.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The metadata name of the rule, inherited through the base type. |
label |
Required. The label displayed for the sharing rule. |
accessLevel |
Required. The only permitted value for a guest rule is Read. |
sharedTo |
Required. Specifies who receives access. Guest recipients are identified through its guestUser selector. |
guestUser |
Within sharedTo, a list of guest user nicknames. These are not user record IDs or site developer names. This selector can be used only with SharingGuestRule. |
criteriaItems |
The individual filter conditions that select records for guest access. |
field |
Within a criteria item, identifies the field evaluated by the condition. |
operation |
The comparison used by a criteria item. Enumerated values are contains, equals, excludes, greaterOrEqual, greaterThan, includes, lessOrEqual, lessThan, notContain, notEqual, startsWith, and within. |
value |
The value evaluated by a criteria item's operation. |
booleanFilter |
Advanced filter logic that combines the individual criteria conditions. |
includeHVUOwnedRecords |
Required boolean, defaulting to false. Controls whether matching records owned by high-volume community or site users are included. It cannot be changed after creation. |
Behavior and Constraints
Recipients and record eligibility are separate
sharedTo.guestUser selects the guest users who receive access. criteriaItems and booleanFilter select the records they can read. Changing either the individual conditions or their advanced filter logic can change which records are exposed to those guests.
includeHVUOwnedRecords adds an ownership condition to record eligibility; it does not expand the recipient audience. With the default value of false, the documented ownership scope includes records owned by authenticated users, guest users, and queues, but excludes records owned by high-volume community or site users. Setting it to true includes that additional ownership category, provided the records also meet the rule's criteria.
Because includeHVUOwnedRecords cannot be edited after the rule is created, this scope must be chosen at creation time. It is not an ordinary updateable setting.
Guest rules cannot grant broader access
accessLevel must be Read. Settings available on other sharing-rule types do not allow a guest rule to grant Edit access.
Although accountSettings belongs to SharingBaseRule, SharingGuestRule explicitly excludes it. Do not use it to configure access to cases, contacts, or opportunities associated with an account.
The reusable SharedTo structure contains selectors for groups, roles, queues, and territories as well as guest users. Their presence in that shared structure does not establish that every selector is valid for a guest rule.
Administrative permissions
Viewing sharing-rule configuration requires View Setup and Configuration. Editing it requires Manage Sharing. These permissions govern administration of the configuration; they are distinct from the Read access that the rule grants to guest recipients.
Deployment and Retrieval
Guest rules are serialized inside the object's SharingRules file, not in separate guest-rule files. Metadata API files are stored in the sharingRules directory, with the object name and the .sharingRules suffix, such as Account.sharingRules. Criteria-based, owner-based, territory-based, and guest user rules share this object-level container.
SharingRules supports retrieving, deploying, and deleting all sharing rules in an organization, and it supports the * wildcard in package.xml. These operations do not support selecting sharing rules solely by category, such as all guest user rules. Manual sharing rules are not supported by these operations.
When preparing guest-rule metadata, keep the target's restrictions even if a shared schema exposes broader options: use Read, omit accountSettings, and supply guest user nicknames in guestUser. Include includeHVUOwnedRecords with the intended creation-time value; an existing rule cannot accept a change to that setting.
An unlocked-package failure can look like a recipient-validation problem. The reported packaging diagnosis and unpackaged deployment alternative are described under Reported Issues below; that report does not establish the cause of every nickname-related error.
Relationships
The most direct dependencies are the fields used to select records and the guest recipients tied to site configuration. The group, role, queue, and territory connections below come from the reusable recipient structure. They describe possible schema connections, not mandatory dependencies of every guest rule or proof that each selector is valid for this rule type.
References
-
CustomField:criteriaItems.field. Changing or removing a field used here affects the rule's record-selection conditions. -
CustomSite:sharedTo.guestUser. This recognized association helps trace the rule to site configuration. The serialized value remains a guest user nickname, not a site name. -
Group:allCustomerPortalUsers,allInternalUsers,allPartnerUsers,channelProgramGroup,channelProgramGroups,group, withinsharedTo. -
Role:portalRole,portalRoleandSubordinates,role,roleAndSubordinates,roleAndSubordinatesInternal, withinsharedTo. -
Queue:sharedTo.queue. -
TerritoryModel:sharedTo.territory,sharedTo.territoryAndSubordinates.
Referenced By
-
SharingRules:sharingGuestRules, the collection containing an object's guest user sharing rules.
Reported Issues
-
An unlocked-package failure can resemble an invalid guest-recipient error. In March 2024, an attempt to package a guest rule for
Knowledge__kavfailed with "Specify a guest user's nickname for the guestUser field." The accepted answer attributed the failure toSharingGuestRulebeing unsupported in unlocked packages and recommended unpackaged Metadata API deployment. Treat this as a reported packaging diagnosis, not a general explanation for every occurrence of that message. Read the packaging discussion.
Common Questions
What value goes in guestUser for a SharingGuestRule?
Use the guest user's nickname. Do not substitute a user record ID or a site developer name. The association with site configuration does not change the serialized value.
Can a guest sharing rule grant Edit access or configure account child access?
No. accessLevel can only be Read, and SharingGuestRule excludes accountSettings. It cannot use that element to configure access to an account's related cases, contacts, or opportunities.
Can I change includeHVUOwnedRecords after creating the rule?
No. It is required, defaults to false, and cannot be edited after creation. Setting it to true at creation includes matching records owned by high-volume community or site users; it does not change who receives access.
Where is SharingGuestRule stored when I retrieve metadata?
It is stored in the object's SharingRules file under sharingRules, inside the sharingGuestRules collection. It is not a separate guest-rule file.
Why does an unlocked package report "Specify a guest user's nickname"?
A March 2024 report attributed this error during packaging of a Knowledge__kav guest rule to unsupported unlocked-package inclusion. The reported alternative was unpackaged Metadata API deployment. That diagnosis is conditional on the packaging context; the message alone does not prove the same cause elsewhere.