Exam Certified Platform Developer II All QuestionsBrowse all questions from this exam
Question 217

Universal Containers uses a custom Lightning page to provide a mechanism to perform a step-by-step wizard search for Accounts. One of the steps in the wizard is to allow the user to input text into a text field, ERP_Number_c, that is then used in a query to find matching Accounts.

A developer receives the exception 'SOQL query not selective enough'.

Which step should be taken to resolve the issue?

    Correct Answer: A

    To resolve the 'SOQL query not selective enough' exception, marking the `ERP_Number_c` field as an external ID is the most suitable solution. An external ID index makes the query more selective and efficient since Salesforce will automatically index the field. This indexing reduces the complexity and improves performance of the SOQL query, helping to avoid the exception.

Discussion
FriedConsole2000Option: B

It is actually "B". https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_VLSQ.htm

stan_maltaOption: A

Other options won't index the field

Udayudyvk1818Option: A

A https://help.salesforce.com/s/articleView?id=000386864&type=1

AppleDashOption: A

Should be A, ERP number should be set as an External ID.

dasabhisek404Option: A

Option A is correct. https://help.salesforce.com/s/articleView?id=000384950&type=1 https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_VLSQ.htm

Yas010101Option: C

Move the SOQL query to within an asynchronous process