Skip to main content
18 votes
Accepted

How to deploy more than one sharing rule in one deployment?

You can ask support to enable a feature called Defer Sharing Calculations. That way, you can suspend sharing rule calculations to not have them run immediately after you have deployed them, but at a ...
Robin De Bondt's user avatar
17 votes
Accepted

Role-based sharing rules for partner community users

I believe what you are looking for is Super User access: Super User Access Users can be assigned super user access to give them access to data owned by other users belonging to the same role ...
Eric's user avatar
  • 54.2k
10 votes
Accepted

The cause of UNABLE_TO_LOCK_ROW error?

The issue is some combination of data skew and (potentially) ownership skew. Furthermore, sharing rules might lengthen the time of parent record locks, leading to increased chances for row locks. ...
Brent Bowers's user avatar
  • 3,144
8 votes

Sharing rules not working on Partner Community Users

What you're attempting to create are Criteria-Based Sharing Rules. Unfortunately, you can't share records with your partners using criteria-based sharing. Instead, you can only share records based on ...
crmprogdev's user avatar
6 votes

How does getSObjectType().getDescribe() work in a 'Without Sharing' Class?

All security-related methods, such as UserRecordAccess and the describe calls, will always return the user's real permissions. All that "without sharing" does is turns off the permission and sharing ...
sfdcfox's user avatar
  • 497k
6 votes

How does getSObjectType().getDescribe() work in a 'Without Sharing' Class?

without sharing will not reinforce SFDC field level access and visibility, so you will be running your class on system context. In system context, Apex code has access to all objects and fields— ...
Carlos Naranjo's user avatar
6 votes
Accepted

Sharing rules and Inner classes

From the documentation, two critical rules: Inner classes do not inherit the sharing setting from their container class. Classes inherit this setting from a parent class when one class extends or ...
David Reed's user avatar
  • 93.2k
6 votes

Is there a typesafe way to work with rowCause?

Refer this documentation: Sharing a Record Using Apex Apex sharing reasons are defined on an object's detail page. Each Apex sharing reason has a label and a name: The label displays in the Reason ...
Santanu Boral's user avatar
5 votes

Restrict Users to Find and Access a specific Case Record Type

You can't really restrict access to view records based on record types from the profile level. if you think of Salesforce as a filing cabinet, each drawer is an object, within the drawer there are ...
Dan Wooding's user avatar
  • 3,611
5 votes
Accepted

Apex managed sharing limits?

All of the notes in the docs apply: Apex sharing reasons and Apex managed sharing recalculation are only available for custom objects. Every time a custom object's organization-wide sharing default ...
sfdcfox's user avatar
  • 497k
4 votes
Accepted

Writing a test class for my sharing rule apex trigger

I think you need to make sure that there are values in all your mandatory fields. The error could be related to a validation rule that fires if you don't insert for a a field related to "department ...
Carlos Naranjo's user avatar
4 votes
Accepted

Apex Sharing trigger

You can do manual sharing using Apex. It is possible to manually share a record to a user or a group using Apex or the SOAP API. If the owner of the record changes, the sharing is automatically ...
Tushar Sharma's user avatar
4 votes
Accepted

OWD and Sharing Rule scenario with Role Hirerachy

For first point yes your assumption is correct. For second point is if in future you want to restrict this for some user and allow for some users then you need to again change the OWD to private but ...
Tushar Sharma's user avatar
4 votes
Accepted

Enable users to change the owner of a case that does not belong to them

The "Transfer Cases" permission will give you the access you are looking for. You can find some information here: https://help.salesforce.com/articleView?id=000175883&type=1 And here: https://...
Sebastian Kessel's user avatar
4 votes
Accepted

Able To Delete Sobject Even if No permission for User

It's allowing you to delete it because it's a without sharing class, in which Apex does not enforce sharing permissions. This is correct behaviour. Also recall that object- and field-level permissions ...
Charles T's user avatar
  • 11k
4 votes
Accepted

Apex records sharing vs standard record sharing

The advantage of Apex sharing is that you can calculate sharing conditions that otherwise cannot be done by standard and criteria-based sharing rules. For example, you could base sharing on an web ...
sfdcfox's user avatar
  • 497k
4 votes
Accepted

Manual Sharing Rules Mysteriously Removed

From the Manual Sharing section of the document "A Guide to Sharing Architecture" https://developer.salesforce.com/docs/atlas.en-us.dat.meta/dat/dat_components.htm Manual sharing is removed ...
Mark Pond's user avatar
  • 23k
4 votes

Salesforce Communities - Records Access

As you are using Customer Community licences you need to use Sharing Sets to allow edit access to their related accounts. Customer Community Plus licences use the standard sharing model unlike high ...
Dave Humm's user avatar
  • 5,111
4 votes

What's the difference between Sharing with Role and Internal Subordinates vs Sharing with Role + Grant Access Using Hierarchies for the object

Grant Access Using Hierarchy (GAUH) transfers whatever permissions a subordinate has for a record to their managers in this role. For example, if a user in c0 can see a record in c2, perhaps by ...
sfdcfox's user avatar
  • 497k
3 votes

The cause of UNABLE_TO_LOCK_ROW error?

You absolutely can get this error by having 2 successive iterations in a batch try to update the same group of parents in a hierarchy. This is one of the worst parts about having data skew and why ...
Matthew McKinley's user avatar
3 votes
Accepted

Efficient way to set up roles and hierarchies using APEX

I have encountered this exact challenge before. The simplest approach I've found is to do the following: Create a Public Group for each Territory/Zone Assign users to their relevant Public Groups ...
Matthew McKinley's user avatar
3 votes

Apex Managed Sharing Records

If the records are created via apex sharing ,then then system does not delete it as a part of recalculation . If you had custom RowCause defined then its easy to query the table and delete those ...
Mohith Shrivastava's user avatar
3 votes
Accepted

how many sharing rules can we create at maximum on standard object in salesforce

The limit is across both Standard and Custom Objects as 300 Maximum rules with 50 Criteria Based rules on Enterprise and Unlimited/Performance Editions only. Criteria based rules are allowed on some ...
Dave Humm's user avatar
  • 5,111
3 votes
Accepted

How can we maintain access to the creator a Case at all times, even when its owner has been changed to Queue

You should leverage Case Team functionality. Basically, whenever Case ownership changes you should add the user to a case team as member and provide read/write access to that user. Here is the ...
Santanu Boral's user avatar
3 votes

best practices around Account sharing?

One bit of advice from past experience -- If you think your org will be the "winning org" when and if you acquire another company or add another business unit wherein the acquired company's users ...
cropredy's user avatar
  • 72.1k
3 votes

How to Activity Access Levels work in SF. When you set "Controlled by Parent" to Activities

The most probable answer to you issue might be how Activity Access Levels work in SF. When you set "Controlled by Parent" to Activities it means: A user can perform an action (such as view, edit, ...
Eduard's user avatar
  • 5,181
3 votes

Is there a typesafe way to work with rowCause?

Just to test out... I created a sharing reason for a test object and ran the following line in Developer Console: System.debug(Schema.MyObj__Share.rowCause.MyCause__c instanceof String); I got back ...
Charles T's user avatar
  • 11k
3 votes

User unable to edit created Contract

I would ideally write a Trigger on After Insert/After Update, and create ContractShare record with edit access. But, You cannot create an Apex Sharing for Contract. Also, Account and contracts are ...
Pranay Jaiswal's user avatar
3 votes

User unable to edit created Contract

Because of M-D relationship of the Account and Contract, if Account has Edit access then Contract will automatically have Edit access. As Contract is Detail object so ownership is governed by Account ...
Santanu Boral's user avatar
3 votes
Accepted

How to allow edit access to for certain record types only

Edit is a CRUD permission on the Object, in this case Opportunity, defined on profile/permission set level. So as long as a User on say Profile A has Edit rights on Opportunity, they will always be ...
Jayant Das's user avatar
  • 30.6k

Only top scored, non community-wiki answers of a minimum length are eligible