Skip to main content
23 votes
Accepted

Inherited Sharing vs No Sharing declaration

When inherited sharing is used, it means that it will inherit the sharing settings of the caller class. If a class with without sharing is calling the method of class with inherited sharing, then it ...
Vijay Ganji's user avatar
  • 6,656
21 votes
Accepted

About the 10 custom objects limitation for community licenses

There are no technical restraints regarding the ten object limit. This is actually mentioned in the documentation somewhere. However, if salesforce.com finds out (however that may be), you would be in ...
sfdcfox's user avatar
  • 497k
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
15 votes

Apex Sharing Reasons - how to enable?

As per the Salesforce Help Documentation Apex Sharing Reasons are only available in Salesforce Classic and I presume based on the screenshot shared above, you are using Lightning Experience. Hence ...
Jigar Shah's user avatar
  • 1,148
11 votes
Accepted

Is it possible to migrate changes to OWD's / Sharing Rules via Changesets?

I know this is an old question, but either the answer has changed or the answer was wrong. OWD is deployed as part of the metadata of the object. https://developer.salesforce.com/docs/atlas.en-us....
horzel_evh's user avatar
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
10 votes
Accepted

Does SOQL join not respect OWD /sharing settings?

An interesting question that spiked my curiosity. I did few tests to analyse this behaviour. I created a Parent Object and Child Object. OWD is private for both. On child Object I created a lookup ...
Pranay Jaiswal's user avatar
9 votes

Does with sharing enforce OLS/FLS?

When you use with sharing keyword in an apex class, and try to query an object which doesn't have read permission on the profile, what would happen? Would it still show some results? The results ...
David Reed's user avatar
  • 93.2k
9 votes
Accepted

Does with sharing enforce OLS/FLS?

When you use with sharing keyword in an apex class, and try to query an object which doesn't have read permission on the profile, what would happen? Would it still show some results? Yes, it could ...
sfdcfox's user avatar
  • 497k
9 votes

How to Deploy Org Wide Sharing with DX

objectSettings is defined in the Scratch Org Definition File, which applies when creating a new org via sfdx force:org:create. These sharing settings are likely not applied when deploying code to your ...
Dan Wuensch's user avatar
8 votes

Can one implement a Mutex / Lock / Semaphore in Salesforce?

My tuppence worth, very much late to the party. We had a need to do this as well. Our customers needed to expose wide sets of data to their users and let them select the sub-set they wanted to ...
Phil W's user avatar
  • 37k
8 votes

How to Share a ContentDocumentLink using "Set by Record"

Set By Record can be done upon assigning ShareType = "I", where it means: Inferred permission. The user’s permission is determined by the related record. For shares with a library, this is defined ...
Santanu Boral's user avatar
8 votes
Accepted

Access Control mechanism of Activity Object?

The OWD definition of Private for activities is little different than how it works for other objects . When you put private as an organization wide default for activities the following is true: ...
Mohith Shrivastava's user avatar
7 votes
Accepted

When is the Sharing Button visible for a Record?

There is a small article on Salesforce help You have access to the Sharing button when your sharing model is either Private or Public Read Only for a type of record or related record. For example, ...
Oles Malkov's user avatar
  • 2,161
7 votes

Deleting Cases from org

It is possible to defer sharing rule calculations, which might help if you are fairly certain sharing recalculation is the root cause. Take a look at Deferring Sharing Rule Calculations. ...
Adrian Larson's user avatar
  • 151k
7 votes
Accepted

Difference between SObject_Share & UserRecordAccess

There are several important differences between MyCustomObject__Share and UserRecordAccess sobjects: MyCustomObject__Share If OWD for MyCustomObject__c is set to the most permissive Public Read/...
Oleksandr Berehovskyi's user avatar
7 votes

How to come to a conclusion to create a Helper class "with" or "without" Sharing

It depends on the purpose of the class, but the usual answer is "neither." A utility class is likely to be called from a number of places, some that use sharing and others that don't. By not ...
sfdcfox's user avatar
  • 497k
7 votes

Inherited Sharing vs No Sharing declaration

If you can refer salesforce docs then you observed the difference between inherited sharing and no sharing. Excerpt from salesforce docs: There is a distinct difference between an Apex class that ...
Anurag Bhardwaj's user avatar
7 votes
Accepted

How does object inheritance interact with sharing inheritance?

Would an instance of SomeClass be without sharing? Yes. Note from Using the with sharing, without sharing, and inherited sharing Keywords Implementation Details About with sharing and without sharing ...
Adrian Larson's user avatar
  • 151k
7 votes

Defer Sharing Calculation - Scratch org issue?

According to Salesforce this is a somewhat cumbersome two way step where using this org feature needs to be accompanied with a second manual step: Enabling the Defer Sharing Rule Calculation ...
Robert Sösemann's user avatar
6 votes
Accepted

Why does apex with sharing allow updates to a read only object?

Like other Apex classes,triggers, all custom controllers run in system mode. Consequently, the current user's credentials are not used to execute controller logic, and the user's permissions and field-...
Pranay Jaiswal's user avatar
6 votes
Accepted

How to Share a ContentDocumentLink using "Set by Record"

This is available now in the Winter '20 release! https://releasenotes.docs.salesforce.com/en-us/winter20/release-notes/rn_files_sharing_set_by_record.htm
Jenny Framularo's user avatar
6 votes

A good explanation for roles/profiles/permission sets and sharing

You can check this link http://hellosnl.blogspot.com/2017/08/salesforce-security-concepts.html Also check this image
nica's user avatar
  • 1,410
6 votes
Accepted

Allow communities user to see multiple Accounts

Yes, sharing sets now support the Contacts with Multiple Accounts feature. Let’s say you create a community or portal user from a contact that is associated with multiple accounts. You can then create ...
sfdc's user avatar
  • 13.7k
6 votes
Accepted

How to override Opportunity Org-Wide Defaults Public Read Only

you can't restrict OWD. OWD is the lowest sharing level. In this case you have to set OWD to Private and do changes to your sharing model. you can use the following algorithm to define proper OWD ...
Oleksandr Berehovskyi's user avatar
6 votes

Is it possible for Apex code to determine whether it is with or without sharing?

This might not be the answer, but let me put my thoughts. When you use inherited sharing it's the responsibility of the caller class to handling the sharing settings for the code which the called ...
Pranay Jaiswal's user avatar
6 votes
Accepted

Unable to Insert ContentVersion record as a Community User in Test Class

The community user should have access to Loan_Doc_Sort__c record to upload files on it. You have few options, Change the OWD of Loan_Doc_Sort__c to public read-only external Create a manual share ...
Pranay Jaiswal's user avatar
6 votes

Clean way to vary sharing at runtime in Apex?

Your code is overly complicated because you presumed you needed an inner class in your RestResource class. You don't. The main problem is that you've reinvented the wheel with Sharing.Executable. ...
sfdcfox's user avatar
  • 497k
6 votes
Accepted

Will an app where all the Apex is "without sharing" pass a Salesforce Security Review?

Before i begin answering this please note below disclaimer Do not consider my answer to be official from Salesforce and always schedule an office hour with the security team to get advice on this. ...
Mohith Shrivastava's user avatar

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