+ Start a Discussion

Getting Field set Name dynamically?


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 

if its is helpful pls like .....
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...????
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());