What to do if your SOSL query is wrong?

What to do if your SOSL query is wrong?

Here is what you can do: 1. In your Execute Anonymous window, use System.debug statements to print Contact and Lead objects from your List > result. 2. If it is returning correct result i.e. at least one Lead and one Contact with their last names Smith, then the problem is with data.

How to write a SOSL query in Java?

The ‘searchContactsAndLeads’ method must accept an incoming string as a parameter, find any contact or lead that matches the string as part of either the first or last name and then return those records. Executing the ‘searchContactsAndLeads’ method failed.

Why is searchcontactsandleads method failed in SOSL?

Executing the ‘searchContactsAndLeads’ method failed. Either the method does not exist, is not static, or does not return the expected search results. PLEASE ADVISE…Thanks Community!!!

Do you have to create a contact record for SOSL?

Because SOSL indexes data for searching, you must create a Contact record and Lead record before checking this challenge. Both records must have the last name ‘Smith’. The challenge uses these records for the SOSL search.

How to check the trailhead challenge in SOSL?

The Apex class must be called ‘ContactAndLeadSearch’ and be in the public scope. The Apex class must have a public static method called ‘searchContactsAndLeads’. Because SOSL indexes data for searching, you must create a Contact record and Lead record before checking this challenge. Both records must have the last name ‘Smith’.

What happens when a sobject field is not selected in a SOSL query?

SOQL and SOSL queries only return data for sObject fields that are selected in the original query. If you try to access a field that was not selected in the SOQL or SOSL query (other than ID), you receive a runtime error, even if the field contains a value in the database.

Is the execute soql and SOSL queries challenge completed?

I am attempting to complete the Execute SOQL and SOSL Queries in the Developer Console Basics module and the challenge is creating logs that have nothing to do with the SOSL inline query that is requested. I have executed the following code in the Execute anonymous window and the challenge still does not show as completed.