Loading

Create manual sharing rules with Data Loader

Udgivelsesdato: Oct 13, 2022
Beskrivelse
It is possible to create manual sharing rules for some objects using Data Loader. 

 
Løsning

Manual sharing records can be created by inserting the share settings to an object using Data Loader. To determine if a standard object supports sharing rule creation via the Data Loader, review Introducing SOAP API and search for the object name plus share (ie AccountShare). If you cannot find the object, it doesn't support sharing rule creation via the Data Loader (ie EventShare and TaskShare).

Create a CSV file that includes three columns: 

1. Record ID - This column should be labeled AccountID, CaseID, LeadID, or OpportunityID, depending on the object you are working with. You can obtain the record IDs by creating and exporting a report that lists the records you want to share, including the Salesforce ID.
2. UserOrGroupID - The ID of the User or Public Group that you are granting access to the record. You can get the User ID by creating and exporting a User report. Using the Data Loader, you can export the User or Group table.
3. Access Level - The column should be labeled AccountAccessLevel, CaseAccessLevel, LeadAccessLevel, or OpportunityAccessLevel, depending on the object. 

One of the following values must be used:

  • Read - User or Group can only view the record.
  • Edit - User or Group can view and edit the record.
The value in this field sets the type of access the User or Group has to the record and must be set to an access level that is at least equal to, or less restrictive than, the organization's default access level for the object/entity in question. Remember that sharing rules are meant to extend access; you would not use them to restrict access.
 
If you're working with the Account object, your completed CSV file would look something like: 
 
AccountIDUserOrGroupIDAccountAccessLevel
001000000012345005000000023456Edit


For example:

  • If the org wide default access for Cases is Public Read/Write, that means that anyone can edit a Case. In this scenario creating sharing rules would not make sense because all users already have Read/Write access to all Cases. You would not create a rule to set access to Read (more restrictive access) for a sub-set of users.
  • If instead the org wide default access for Cases is Private, you can use sharing rules to open access Read or Edit (Read/Write) access to other users or groups.

After preparing your .csv data file, use Data Loader to insert (create) records in the appropriate sharing table, such as AccountShare, CaseShare, LeadShare or OpportunityShare. You can access these by clicking on the "Show all Salesforce objects" checkbox in the Data Loader at the step where you select data objects.

Your new sharing rule entry will appear as a "Manual" sharing rule, as if it was created by clicking the "Share" button on the record directly in Salesforce.

Note the following behaviors on sharing object availability for custom objects in the Data Loader:

  • Like standard objects, the sharing objects for custom objects are not available if its org wide default access is set to Public Read/Write.
  • A sharing rule object is created for each custom object if it does not have a master-detail relationship to another object.
  • The user creating the custom object must have the “Manage Sharing” permission for a sharing rule object to be automatically created for it.


Custom objects that meet the criteria above are available for selection in the Data Loader and appear in the "Show all Salesforce objects" view as: Share: CustomObjectName (CustomObjectName__Share)


See Also:
Install Data Loader
 

Vidensartikelnummer

000385389

 
Indlæser
Salesforce Help | Article