Salesforce Platform Developer I (legacy) — Question 50

How can a developer warn users of SOQL governor limit violations in a trigger?

Answer options

Correct answer: C

Explanation

The correct answer, C, is accurate because it allows developers to check the current number of queries using Limits.getQueries() and proactively display a warning before reaching the limit. Options A and D are incorrect as they do not prevent the limit violation; they only notify the user after the fact. Option B is also incorrect because redirecting does not address the issue of exceeding SOQL queries in a trigger context.