+ Start a Discussion
eswarsfeswarsf 

How to get all field names in ApexCode?

Hi,

I want to get all field names and object names in my Org.I am using "getGlobalDescribe" and "fields.getMap" in my apex code.but with this code i can access only upto 100 objects,if i am trying to access more than 100 objects it is throwing me error.

 

Kindly let me know is there any work around for this.

 

Thanks,

Best Answer chosen by Admin (Salesforce Developers) 
spraetzspraetz

Not possible in a single request.  You can only do 100 describe calls.  You would need to use a batch job.

All Answers

spraetzspraetz

Not possible in a single request.  You can only do 100 describe calls.  You would need to use a batch job.

This was selected as the best answer
eswarsfeswarsf

Thanks Ryan for update.

ravimsfdcravimsfdc

HI Eswar,

I has to solve similar issue, may i know your application please?

 

Thanks

Ravi

Starz26Starz26

The approach is that it is not possible. If you require real time results you will not be able to do this.

 

The only way around it is to create and object to hold the obkect and field names. Then write a batch apex job to populate / update the object with the value. Then you can reference the value in that object at a later time in any trigger or class.

 

But you cannot do it on the fly if you need to do more than 100 describe calls

ravimsfdcravimsfdc

Thanks Eswar