What will automatically obey the organization wide defaults and - ProProfs Discuss
Cancel
TopicsDown
Products Down
Follow Us:
FacebookTwitter
Advertisement

What will automatically obey the organization-wide defaults and sharing settings for the user who executes the code in the salesforce organization?
Reference: A developer has a block of code that omits any statements that indicate whether the code block should execute with or without sharing. 

What will automatically obey the organization-wide defaults and sharing settings for the user who executes the code in the salesforce organization?

<br/>Reference: A developer has a block of code that omits any statements that indicate whether the code block should execute with or without sharing. 

Change Image    Delete

A. Apex Triggers
B. HTTP Callouts
C. Apex Controllers
D. Anonymous Blocks

This question is part of platform dev i
Asked by Holly, Last updated: Sep 25, 2020

+ Answer
Request
Question menu
Vote up Vote down

9 Answers

G. Roland

G. Roland

G. Roland
G. Roland, Professor, Austin

Answered Jul 09, 2018

The answer is Anonymous Blocks. With the choices that are available, it can be confusing if this is the option or Apex Trigger. Apex Trigger can be used in order to compile data and execute everything that is needed. Apex Trigger can be used in system mode but it is only Anonymous Blocks that can help get user permissions.

Remember that you cannot use Apex Triggers if you want to update a field if you would not be able to use it. You cannot use the other codes that are given to you. The Apex code can get stuck in the metadata but it can be executed when needed.

upvote 1 downvote
Reply 

John Adney

John Adney

John Adney
John Adney

Answered Feb 18, 2017

Anonymous Block and Apex Triggers and not Apex Controllers (you have specify with sharing in order to take effect) , but with Apex Triggers you can't update a field if user can't access it.
upvote 1 downvote
Reply 

padrinathp

padrinathp

padrinathp

Anonymous Blocks is correct.

upvote 1 downvote
Reply 

vinay.oy254

vinay.oy

vinay.oy254
Anonymous Blocks only.
upvote 1 downvote
Reply 

SFDC Dev

SFDC Dev

SFDC Dev
SFDC Dev

Answered Aug 07, 2017

Ans is Apex Trigger.

Though Anonymous block can be excuted in devleoper console without sharing/permission, it need Authour Apex to be enabled for API access. Thus it does comes under normal OWD. But trigger is irrespective of any enabling checkbox.

upvote downvote 1
Reply 

BunniesKill

BunniesKill

BunniesKill
Anonymous Blocks is correct.
upvote downvote
Reply 

mudasirwani

mudasirwani

mudasirwani
If we use with sharing on controller it will also take care.
C. Apex ControllersD. Anonymous Blocks
upvote downvote 1
Reply 

michaelwit

michaelwit

michaelwit
Apex Triggers execute in system mode. Only Anonymous Blocks take account of user permissions.
upvote downvote
Reply 

John Smith

John Smith

John Smith
John Smith

Answered Sep 08, 2016

Apex Triggers
2. Anonymous Blocks
upvote downvote 1
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.