+ Start a Discussion
aks0011aks0011 

Getting Field set Name dynamically?

Hi,


I want to get if Opportunity has an Field set of it's Fields, by knowing only that it's an opportunity record.


if any one know it than please let me know . thanks in advance ...... :)
sushant sussushant sus
According to my understanding requirement is that
you can put all object in picklist when you can select any one object that willl show all field
for this you can use refer this 
http://developer.force.com/cookbook/recipe/retrieve-a-list-of-objects-using-apex
http://blogs.developerforce.com/developer-relations/2008/12/using-the-metadata-api-to-retrieve-picklist-values.html
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_describe_objects_understanding.htm

if its is helpful pls like .....
aks0011aks0011
Thanks for the consideration but I already have all the object names but still I just want to get their field set names or label if they have any...????
Elie.RodrigueElie.Rodrigue
You can do SObjectType.Opportunity.FieldSets.FieldSetName.getFields().
You could also do SObjectTYpe.Opportunity.FieldSets.getMap().get('fieldsetname') if you want it dynamic.
From there you could do :
for(Schema.FieldSetMember f :SObjectTYpe.Opportunity.FieldSets.getMap().get('fieldsetname'))
{
      System.Debug(f.getLabel() + ' - ' + f.getFieldPath());