Dynamic SOQL

Dynamic SOSL refers to the creation of a SOSL string at run time with Apex code. Dynamic SOSL enables you to create more flexible applications.

Sample SOSL:

String strName = 'Test';
String searchquery = 'FIND \'' + strName + '*\' IN ALL FIELDS RETURNING Account(Id,Name), Contact, Lead'; 
List < List < SObject > > searchList=search.query(searchquery);
system.debug('Search List is ' + searchList);

Cheers!!!

No comments:

Post a Comment