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
dai.odaharadai.odahara 

method like describeSObject with force.com API

Hi, I'm trying to gather all fields of Object. For instance, Name, Id, Tel, WebSite,....of Account.
I know we could do it with Force.com API - describeSObject( Account ), but do you know how to do it with Apex Code?

Please let me know if anyone knows it...

Thank you very much,
TehNrdTehNrd
I do not believe this is currently possible with Apex as it does not yet have the ability to look at the metadata of an object.

Rumor has it the next version of apex will be able to do this, select *  from, but there is no word on ETA.


Message Edited by TehNrd on 03-20-2008 01:30 PM
dai.odaharadai.odahara
Yes, I've heard of the rumor...Hope it'll come out soon..

BTW how do all guy get meta-data dynamically with Apex Code..?

Do you know some workaround about it..?
cgosscgoss
For anyone who runs across this in the future- this functionality is described in the APEX docs here.


Message Edited by cgoss on 07-24-2008 09:27 AM
d3developerd3developer
lifesaver!
d3developerd3developer

 

Here's the exact code in case someone wants it ('cause it took me awhile to figure out) :

 

 

//SObject mySObjectInstance = something

Map<String, Schema.SObjectField> myFieldNames = mySObjectInstance.getSObjectType().getDescribe().fields.getMap()