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
Deepak PansariDeepak Pansari 

Any alternate query for (Select * from Lead)

Hi All,

I want to fetch all the field of Lead object without specified column name like

e.g.
Lead l = select name, city from lead where id=xxxxxxxxxx; [ not want ]

I want some thing like

Lead I = select * from lead where id =xxxxxxxxxxxxxxxxxx

Please help me .

Thanks in advance
Deepak Pansari
David GorslineDavid Gorsline
This is the way we did it, a couple of versions ago. There may be a simpler way now.

Do a .describeSObjects() on the Lead object. This call returns an array of DescribeSObjectResult[]. Loop through that array and access the array of Field[] for each element of the array. Then loop through the inner array and append a field name to your query expression for each field that you find.