Skip to main content

The challenge: 

http://trailhead.salesforce.com/content/learn/modules/apex_database/apex_database_soslCan't finish the challenge Write SOSL QueriesMy Code:

public class ContactAndLeadSearch{

public static List<List<sObject>> searchContactsAndLeads(String searchString){

List<List<sObject>> queryResult = [FIND :searchString IN ALL FIELDS RETURNING Contact(Id where LastName=:searchString Order By Name), Lead(Id where LastName=:searchString Order By Name)];

Contact[] contacts = (Contact[])queryResult[0];

Lead[] leads = (Lead[])queryResult[1];

return queryResult;

}

}

it still fails when i add name and lastName to the SOSL result, i even tried making a List<List<sObject>> containing both the Contact and Lead list and it still failed. Help please 

 

#Trailhead Challenges

2 réponses