public class ContactAndLeadSearch { public static List<List<sObject>> searchContactsAndLeads(String a) { try { List<List<sObject>>cssosl = new List<List<sObject>>([FIND :a IN ALL FIELDS RETURNING Contact(FirstName,LastName)]); System.debug('in try' + cssosl); return cssosl; } catch (exception e) { System.debug('fail'); } return null; } }
Hi brandom,
Is very important to add
RETURNING Contact(LastName),Lead(Name)
Try this
public class ContactAndLeadSearch {
public static List<List<sObject>> searchContactsAndLeads(String p1){
try {
List<List<sObject>>cssosl = new List<List<sObject>>([FIND :p1 IN ALL FIELDS RETURNING Contact(LastName),Lead(Name)]);
System.debug('in try' + cssosl);
return cssosl;
} catch (ListException e) {
System.debug('fail: '+ e.getCause());
return null;
}
}
}