function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
srilathasrilatha 

display records in vf pages for opportunity,account,leads based on data using sosl query

Hi 

i want to display records based on data in sosl query,in which records that data reside. i want to display  total records seperatly for aacount,leads,opportunitys in signal page for that data

 

please help me for this

regards

Bhavana

Yoganand GadekarYoganand Gadekar

Hi,

U can store the retrived results in different lists and then use the lists to display as required.

Note that sosl provided record of different objects in proper order how it is queried. For example in following example u can store leads with index 0, index 1 for account and 2 for oppotunity. This as per query order.

 

protected List<List<sObject>> searchResults  = new List<List<sObject>>{};

string Squery = ''find 'xx'  in ALL FIELDS RETURNING  lead(id,name),account(name,phone),opportunity(name,id)';

searchResults  = search.query(Squery);

List<Lead>resultListLeads = ((List<Lead>)searchResults[0]); 

List<account> resultaccountList = ((List<account>)searchResults[1]);                                               
 List<Opportunity> resultListOpportunity = ((List<Opportunity>)searchResults[2]);