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
rajesh_yrajesh_y 

list of documents in visualforce page

 

hi all this is my code

 

public class docs 

{

list<document> dlist=new list<document>();

public docs()

{for(document d:[select name from document limit 5])

{

dlist.add(d);

}

}

public list<document> getdlist()

{return dlist;}}

i am getting error like.Error: docs Compile Error: Loop variable must be an SObject or list of Document at line 6 column 14

 

whats wrong in my code please help me

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Not a custom controller - any apex class at all named Document in your organization will give you this error.

 

 

All Answers

bob_buzzardbob_buzzard

This saved and compiled fine in my dev org.

 

Do you have a custom class called document in your org?  

rajesh_yrajesh_y

ni donot have any custom controller with a name document

bob_buzzardbob_buzzard

Not a custom controller - any apex class at all named Document in your organization will give you this error.

 

 

This was selected as the best answer