233k views
3 votes
You can specify the User for which the anonymous block should be executed as.

1. True
2. False

User Vansan
by
7.8k points

1 Answer

6 votes

Final answer:

The statement is false; you cannot specify a different user context for an anonymous block to run as in Salesforce. It always runs as the currently logged-in user.

Step-by-step explanation:

The statement is false. In Salesforce, when you run an anonymous block, it is always executed in the context of the currently logged-in user. You cannot specify a different user context for an anonymous block to execute as. Anonymous blocks are pieces of Apex code that are executed on-the-fly and are often used for testing, data manipulation, or quickly executing Apex code without the need for triggers or classes. The permission and visibility of the logged-in user are taken into account when running the anonymous block.

User Hal Canary
by
8.4k points