How to create manual sharing rules in CRM using Data Loader?
To mass insert manual sharing rules for any standard object or custom object using the Data Loader, you need three columns in a .csv data file containing:
- Record ID (e.g., AccountID, SurveyTargetID, or OrderID)- the Id of the record to be shared.
- The user or Public Group ID (UserOrGroupID). Using Data Loader, export the User or Group table.
- Access Level (Examples: AccountAccessLevel, CaseAccessLevel, LeadAccessLevel, or OpportunityAccessLevel). 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
Note: Access Level cannot be loaded as All. The All access level can only be used by Force.com managed sharing.
The value in this field sets the type of access the User or Group has to the record. It 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 objector entity in question. Remember that sharing rules are meant to extend access. They are not used to restrict access.
The imported record has a RowCause = Manual.
Salesforce Documentation: Sharing a Record Using Apex