function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun ChopraVarun Chopra 

Security review checks

Hi,

Is it mandatory to use isCreateable(), isAccessible(), isUpdateable() and isDeleteable() in apex code?
As in my case I have more than 100 fields in an sObject and to get all fileds data I have check isAccessible() on all fields. This does not seem to be the correct way to do this.
Can you please let me know how to do this efficienly or provide a dowumentation on this?

Regards
Abhishek
PrasanntaPrasannta (Salesforce Developers) 
Hi,

Apex generally runs in system context except for "Execute Anonymous", so the current user's permissions, field-level security, and sharing rules aren’t taken into account during code execution.

Because these rules aren't enforced, developers who use Apex must take care that they don't inadvertently expose sensitive data that would normally be hidden from users by user permissions, field-level security, or organization-wide defaults.

CRUD operations are at the core of many database-driven applications. With databases of tens or hundreds of tables, a good CRUD component is the key for user satisfaction and developer productivity.

Hope this information helps. Kindly mark it as best answer if the information is helpful.

PrasanntaPrasannta (Salesforce Developers) 
Also Please refer to this link below to know  how to put CRUD checks for fields through apex code-

https://developer.salesforce.com/page/Enforcing_CRUD_and_FLS

Hope it helps.