//This method loads all the instances for a page private void loadInstances() {
//This method loads all the instances for a page
private void loadInstances() {
instancesMap = new Map<Id, sObject>([SELECT Id, Name, Value__c, Type__C, content__c FROM sObject);
//debug account ...
for (sObject items: instancesMap.values()) {
subClassObject subItem = new subClassObject(items.Name);
subItem.Id = Item.Id;
if (items.Type__c.equals('Picklist') || adi.Type__c.equals('Multipicklist')) {
subItem.pickList = createLists(content__c); //generates selection list based on values
}
if (item.Type__c.equals('String'))
{
subItem.value = Item.value__c'
}
}
}
// This method adds an instance from a selection list which the user chooses in the UI
public void addItem() {
for (String id : selectedInstances) {
//creates new sublcass object and adds it to the instanceMap
instanceMap.put(subItem.Name, subItem);
}
}
}
public PageReference save() {
Account account = (Account) controller.getRecord();
List<sObject> sObjectList = new List<sObject>();
subClass subItem;
for (subClass subItem : InstanceMap.Values()) {
//Set all the fields for the sObject
sObjectList.add(subItem);
}
upsert detailInstanceList;
return ApexPages.currentPage();
}