Linked Questions

7 votes
1 answer

Default class is with sharing or without sharing? [duplicate]

Can anybody tell me about the with sharing and without sharing of apex class ? Why we can use it ? If we are not specify the keyword with sharing or without sharing which keyword set by default for ...
Nihar's user avatar
  • 1,172
14 votes
3 answers

Does "with sharing" only apply to 1st entry point of code?

I was watching an old Dev 501 video today (#4 Classes & Objects) in which the instructor said profile based sharing rules were only checked at the entry point where apex code begins it's execution....
crmprogdev's user avatar
  • 40.8k
3 votes
1 answer

Sharing rules and Inner classes

If I have 2 classes, Class A and class B. Class B has an inner class called Class C. Class A calls class C. My question is whether class c enforces sharing rules or not. Public with sharing class a{ ...
M guy's user avatar
  • 763
1 vote
1 answer

How does object inheritance interact with sharing inheritance?

Let's say I have some class: public abstract without sharing MyUnsharingClass { // Some methods... } which is extended by public SomeClass extends MyUnsharingClass { // Some methods... } ...
Brian Kessler's user avatar
5 votes
1 answer

Update of Locked Records works in Future Calls

We have seen an interesting behaviour. When we call a method which tries to update locked records it failes with ENTITY_IS_LOCKED. When we call the same method as a future method it works! By design? ...
Marc's user avatar
  • 1,675
2 votes
1 answer

Can a trigger populate the Manager on User records from a custom field?

We've delegated User creation and Administration to helpdesk staff, but the delegated Admins cannot populate the Manager field because only someone with edit all data can populate that field. Is it ...
J Burchett's user avatar
-3 votes
2 answers

Why "without sharing " is used in an Apex class explicitly? [closed]

Why "without sharing " is used in an Apex class explicitly as we know that in absence of ' Without sharing' keyword, it is by default in apex class?
ramatbis's user avatar
0 votes
2 answers

CRUD/FLS Enforcement in Apex code

I was under the impression that if you declared your classes as: global with sharing class HsignUtils { ... } Then any SOQL you ran in there would be automatically mindful of CRUD/FLS permissions. ...
user1813867's user avatar
1 vote
1 answer

`sharing` / `without sharing` keywords inheritance behaviour

I have a doubt regarding sharing mechanism in Salesforce. If we have these classes: public without sharing class Ctrl1 { } public with sharing class Ctrl2 extends Ctrl1 { } By reading the ...
Luís Soares's user avatar
0 votes
1 answer

System mode or user mode?

Salesforce document says - If an extension extends a standard controller, the logic from the standard controller doesn’t execute in system mode If i am using an extension extnding standard controller,...
Sara's user avatar
  • 1,154
-1 votes
2 answers

With sharing and without sharing in apex

What does it mean by "Sharing rule of the current user will be enforced for 'with sharing class' ". Does it mean, if the current user does not have permission on any object that is being queried/...
starhunter's user avatar
0 votes
1 answer

CRUD & FLS - Trailhead

I'm passing the Data Leak Prevention module and have faced some misunderstanding here in this unit Controller: public with sharing class CRUD_FLS_Challenge { public List<Treasures__c> ...
pincet's user avatar
  • 807
-4 votes
1 answer

When we use Apex sharing? what are the different situations we use? [closed]

We have Role-hierarchy, sharing rule, Manual sharing. When we go for Apex sharing? what are the different situation we use?
Ravindar Admin's user avatar
2 votes
1 answer

Classes with no sharing declaration don't behave the same as those "without sharing"

I had been under the impression that omitting a sharing declaration was equivalent to using "without sharing", but that appears to not always be true. For example, if I have legacy code like ...
Matthew Souther's user avatar
0 votes
1 answer

Hide Objects while having permissions

We use batchable Apex and we use 2 custom objects to process a CSV with some records and then insert them or update them as Account records. So, i give permissions to the user's profile that runs this ...
Giorgos Galaios's user avatar