You need to sign in to do that
Don't have an account?

Using Field Set with unknown Object at runtime
Hi,
I would like to use fieldset in a VF Page but unfortunately, I don't know the name of my Object at the compilation time but first at the runtime.
To use a fieldset, it looks normally like this: {!$ObjectType.Account.FieldSets.MyFieldSet} with MyFieldSet the name of the fieldset and Account the object... But in my case, I have to do something generic and I don't know if it's an Account, or a Contact, or anything else. So I would like to be able to do something like {!$ObjectType.get('Account').FieldSets.MyFieldSet} and to remplace the string 'Account' with a variable from my controller.
Anyone has an idea?
Thank you!
Not Possible, you have to provide field set name in the VFP staticll , can not decide it at run time,
I would suggest to think your implementation with dynamic binding without using field set, using map.
If you want to see an example
http://forceschool.blogspot.com/2011/06/dynamic-binding-when-object-name-is.html
thank you for your answer! I was doing now indeed something similar like in your example but fieldsets are much nicer, unfortunately, they are useless in many cases