+ Start a Discussion
Jayaramu T 9Jayaramu T 9 

I want to avoid "database.query(cvQuery)" this in for loop because it is getting toomany SOQL statements can any one please help me on this?

for(List<ContentVersion> cvObjList : database.query(cvQuery))
Sandeep YadavSandeep Yadav
Hi Jayaramu,
You can save the result of database.query(cvQuery) statement in a List of sObject Type and then u can iterate that list.
like this
List<ContentVersion> objList = database.query(cvQuey);
for(ContentVersion cv : objList){
   // your logic
}
Let me know if it is helpful for you or not.
Thanks
Sandeep