Salesforce Certified Platform Developer II — Question 119
What is a consideration when using bind variables with dynamic SOQL? (Choose two.)
Answer options
- A. Dynamic SOQL cannot reference fields on bind variables
- B. Dynamic SOQL cannot use bind variables
- C. Bind variables must be public or global
- D. Bind variables must be in local scope
Correct answer: A, D
Explanation
Option A is correct because dynamic SOQL does not allow referencing fields directly on bind variables, which could lead to runtime errors. Option D is also correct as bind variables must reside within the local scope to be utilized in dynamic SOQL queries, ensuring they are accessible at the time of execution. Options B and C are incorrect because dynamic SOQL can indeed use bind variables, and there is no requirement for bind variables to be public or global.