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
vijendahr kvijendahr k 

SOSL dynamic query issue

Due to some email field in my org, i cant query use email fields in soql query on ontact object. hence i developed below logic,
conset i am using it just for sample puruose, in my code source of email address are different . i collectd in set.

list<contact> conset=[select email from contact where email != null];
list<contact> conlist= new list<contact>();
set<string> emailids= new set<string>();
for(contact c:conset)
    if(!='' || != null )

string querystring='';
string querystringACt='';
boolean Soslflg=false;
for(string str:emailids)
    querystring+=str+ ' OR ';
    if(querystring.length() >300)
        system.debug('inside soslflag'+querystringACt );
        List<List<SObject> > contacts = [FIND :querystringACt IN ALL FIELDS RETURNING Contact (id,name,email)];
       system.debug('sosl query'+contacts );
        system.debug('conlist== '+conlist);
       querystringACt ='';
in the qbove query List<List<SObject> > contacts = [FIND :querystringACt IN ALL FIELDS RETURNING Contact (id,name,email)]; is always cming as blank. could you tell me what is the reason.

i tried below snippet . its working but inside loop its not working :--
string querystringACt=' OR OR OR OR OR OR OR OR OR b.levy@expressl& OR j.davis@expressl& OR OR OR';
List<List<SObject> > contacts = [FIND :querystringACt IN ALL FIELDS RETURNING Contact (id,name,email)];
system.debug('conlist== '+contacts[0]);

can any please help me fix it up

Thanks Advance