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
KidNikiKidNiki 

Can someone help me understand Apex Describe? Looping through a number of picklists on an object...

Hello,

 

I've read through the docs and I've seen it used in code but I still don't fully comprehend when to use it.  I have an object with 34 pick lists on it, I want to loop through those, without having to write 34 if statements.  They are numbered like so, "q1__c", "q2__c", etc.  Could I use sObject.describe to get a count of these and then loop through them?

 

Thank you in advanced!

Andy BoettcherAndy Boettcher

You are indeed doing down the right path with getDescribe...check out this post:

 

http://boards.developerforce.com/t5/Apex-Code-Development/Picklist-values-from-getDescribe-dynamically/m-p/144439#M19473

 

-Andy

KidNikiKidNiki

I'm reading through it, thank you very much!