When the user enters his name from third party application, The user needs to get all the records(Account,Contact,Lead) matching the text entered by him.
I have used sosl for this purpose.But I cant able to show the fetched values from the list(account,contact,lead).
I am getting an error in this class.
Error: Compile Error: Initial term of field expression must be a concrete SObject: List at line 22 column 23
global class exposewsdl{
global class requestKT{
webservice string inputName;
}
global class responseOfWs{
webservice string name;
webservice string errorFound;
}
webservice static responseOfWs getCaseDetailsFromcsNum(requestKT csNum){
try{
List<Opportunity> optyList =New List<Opportunity>();
List<contact> conList= New List<contact>();
List<account> accList=New List<account>();
String searchStr1 = '*'+csNum.inputName+'*';
String searchQuery = 'FIND \'' +searchStr1 + '\' IN ALL FIELDS RETURNING Account (Name),Contact(name),Lead(name)';
List<List <sObject>> searchList = search.query(searchQuery);
accList = ((List<Account>)searchList[0]);
conList = ((List<contact>)searchList[1]);
optyList = ((List<Opportunity>)searchList[2]);
responseOfWs res = new responseOfWs();
res.name= accList.name;
return res;
}catch(Exception e){
responseOfWs res = new responseOfWs();
res.errorFound = e.getMessage();
return res;
}
}
}
Please help me how to display all records, once the user enter his name in SOAP tool.
Thanks in advance