Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Standard Controller with Extension in Salesforce vs with sharing extension - which is better?

Asked by David Edmunds Feb 27, 2023 599 views 1 answer
Share

About this question

 I am not clear with below two concepts - are both actually same?


Standard Controller with Extension

Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply.


With Sharing

Use the with sharing keyword when declaring a class to enforce sharing rules of the current user. Explicitly setting this keyword ensures that Apex code runs in the current user context.


The only difference I see in "Standard Controller with Extension" is, this also runs in User context, but ensures User Permissions and FLS are enforced.. Whereas, with sharing only enforce sharing settings of the User and doesn't care about Object access or FLS of the user..


Is my understanding correct? kindly help!

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.