You need to sign in to do that
Don't have an account?
Sujendran Sundarraj 8
dymanically generate SOQL query using list<string>
I have a requirement to select an object from the list and then select the required fields. Once I click query it has to generate an SOQL query for that select fields. I did it but it is coming with brackets like in the above image. Please help me to fix the issue.
My Method is:
public void query(){
map<integer,string> strl = new map<integer,string>();
for(integer i=0 ; i<getfields.size(); i++){
strl.put(i,getfields[i]);
}
system.debug('strl===>' +strl);
inputrec = 'select '+strl.values()+' from ' +strObjectName;
}
Thank you in advance.
Regards,
Sujendran.
My Method is:
public void query(){
map<integer,string> strl = new map<integer,string>();
for(integer i=0 ; i<getfields.size(); i++){
strl.put(i,getfields[i]);
}
system.debug('strl===>' +strl);
inputrec = 'select '+strl.values()+' from ' +strObjectName;
}
Thank you in advance.
Regards,
Sujendran.
Check below code once Kindly mark this as solved if the reply was helpful.
Thanks
Shaik
All Answers
Check below code once Kindly mark this as solved if the reply was helpful.
Thanks
Shaik