You need to sign in to do that
Don't have an account?
jadent
Map Creation of SObject at runtime
I would like to create a map of SObjects but i will not know which SObject until runtime, so the data type declartion would be Map<Id, SObject>. But since only concrete maps are allowed i cannot create a Map (new Map<Id, SObject>. Is there a way to dynamically create a map of SObjects?
For example here is a workaround for Lists.
List<SObject> myList;myList = (List<SObject>)[SELECT Id, Name FROM Account];
now myList contains a List of Account sobjects. Is there a similiar workaround for doing this with Maps?