Skip to main content

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;     }  }

3 个回答
  1. 2022年7月16日 13:06

    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;

    }

    }

    }

0/9000