No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
SharingSet
Represents a sharing set. A sharing set defines an access mapping that grants portal or community users access to objects that are associated with their accounts or contacts. It extends the Metadata metadata type and inherits its fullName field.
For example, you can grant portal or community users access to all cases related to their account record. Similarly, you can grant portal or community users access to all cases related to a parent account that is identified on the user’s account record. For more information, see “Sharing Set Overview” in the Salesforce Help.
File Suffix and Directory Location
SharingSet components have the suffix .sharingSet and are stored in the sharingSets folder.
Version
SharingSet components are available in API version 30.0 and later.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| accessMappings | AccessMapping[] | A list of access mappings on a sharing set. |
| description | string | The sharing set description. Limit: 255 characters. |
| name | string | Required. The unique identifier for API access. Corresponds to Sharing Set Name on the user interface. |
| profiles | string[] | The profiles of users that are granted access to the target
objects. Valid values are:
|
AccessMapping
AccessMapping represents an access mapping in the sharing set, which grants access to a target object by looking up to an account or contact associated with the user.
You can grant portal users access to a target object, or to both a target object and its associated objects, such as an account and its contacts and cases.
| Field Name | Field Type | Description |
|---|---|---|
| accessLevel | string | The target object access level granted to the portal user.
Valid values are:
|
| objectField | string | A lookup to the target object, which supports standard or custom fields, or an Id. For accounts or cases associated with entitlements, use Entitlement.Account or Entitlement.Case. |
| object | string | The target object to which the portal user is gaining access,
and refers to one of the following:
Portal users gain access to all order entitlements and order items under an account to which they have access. |
| userField | string | The user’s lookup to an account, contact, or a standard
or custom field derived from an account or contact. Either the user
or the user’s manager can be used in the lookup. Valid values
are:
Field refers to a standard or custom field based on an account or contact. |
Declarative Metadata Sample Definition
The following is an example of a SharingSet component that grants users access to all contacts whose ReportsTo fields match the users’ contacts.
1<?xml version="1.0" encoding="UTF-8"?>
2<SharingSet xmlns="http://soap.sforce.com/2006/04/metadata">
3 <accessMappings>
4 <accessLevel>Read</accessLevel>
5 <objectField>ReportsTo</objectField>
6 <object>Contact</object>
7 <userField>Contact</userField>
8 </accessMappings>
9 <description>User Access Mapping</description>
10 <name>User</name>
11 <profiles>customer community user</profiles>
12</SharingSet>The following is an example of a SharingSet component that grants users access to all cases that are related to an entitlement, which is associated with the user’s account.
1<?xml version="1.0" encoding="UTF-8"?>
2<SharingSet xmlns="http://soap.sforce.com/2006/04/metadata">
3 <name>Case</name>
4 <accessMappings>
5 <accessLevel>Edit</accessLevel>
6 <objectField>Entitlement.Account</objectField>
7 <object>Case</object>
8 <userField>Account</userField>
9 </accessMappings>
10</SharingSet>The following is an example of a SharingSet component with a list of access mappings.
1<?xml version="1.0" encoding="UTF-8"?>
2<SharingSet xmlns="http://soap.sforce.com/2006/04/metadata">
3 <description>This is a basic sharing set with several access mappings.</description>
4 <name>Basic</name>
5 <profiles>customer community user</profiles>
6 <accessMappings>
7 <accessLevel>Read</accessLevel>
8 <objectField>Id</objectField>
9 <object>Account</object>
10 <userField>Account</userField>
11 </accessMappings>
12 <accessMappings>
13 <accessLevel>Edit</accessLevel>
14 <objectField>Account</objectField>
15 <object>Contact</object>
16 <userField>Account</userField>
17 </accessMappings>
18 <accessMappings>
19 <accessLevel>Edit</accessLevel>
20 <objectField>Contact</objectField>
21 <object>Case</object>
22 <userField>Contact</userField>
23 </accessMappings>
24 <accessMappings>
25 <accessLevel>Read</accessLevel>
26 <objectField>AccountLookup__c</objectField>
27 <object>HVPUAccessible__c</object>
28 <userField>Account</userField>
29 </accessMappings>
30</SharingSet>The following is an example package.xml that references the previous definition.
1<Package xmlns="http://soap.sforce.com/2006/04/metadata">
2 <fullName>SharingSetBasic</fullName>
3 <types>
4 <members>HVPUAccessible__c.AccountLookup__c</members>
5 <members>HVPUAccessible__c.ContactLookup__c</members>
6 <name>CustomField</name>
7 </types>
8 <types>
9 <members>HVPUAccessible__c</members>
10 <name>CustomObject</name>
11 </types>
12 <types>
13 <members>Basic</members>
14 <name>SharingSet</name>
15 <types>
16 <version>30.0</version>
17</Package>