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
BARJRDBARJRD 

Dynamically list all methods from DescribeSObjectResult

I would like to create a drop-down list of all the methods returned from a  DescribeSObjectResult (e.g., "getLabel", "getName", "getKeyPrefix", etc.).  I have been able to create a list of fields (using DescribeFieldResult) as well as child relationships, record type info, etc., but not a list of just the methods.

 

How can I accomplish this?

 

Thanks,

Barb R.

Best Answer chosen by Admin (Salesforce Developers) 
sebcossebcos

Hi,

this is currently not possible.

What you are trying to do falls under the reflection capabilities of a language. Apex does not currently allow this.

On one hand, the methods that you want to list for sObject are standard and can be found here, allowing you to hardcode them in the drop-down list:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject_describe.htm .

On the other hand, if you are interested in for Apex Reflection support you might want to vote for this idea:

http://success.salesforce.com/ideaView?c=09a30000000D9xtAAC&id=08730000000BrVaAAK .

All Answers

sebcossebcos

Hi,

this is currently not possible.

What you are trying to do falls under the reflection capabilities of a language. Apex does not currently allow this.

On one hand, the methods that you want to list for sObject are standard and can be found here, allowing you to hardcode them in the drop-down list:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject_describe.htm .

On the other hand, if you are interested in for Apex Reflection support you might want to vote for this idea:

http://success.salesforce.com/ideaView?c=09a30000000D9xtAAC&id=08730000000BrVaAAK .

This was selected as the best answer
BARJRDBARJRD

Thanks....I was hoping NOT to hard-code --- I will vote for Apex reflection support.