You need to sign in to do that
Don't have an account?
Assigning sObject field value within Wrapper Class Map from another Wrapped sObject Map
I have a datatable of sObjects that I paginate over. In order to preserve the user information for the selected objects I was capturing the selected objects and placing their values in another map. This was working until i decided to expermient with generic sObjects. This is just quick code as my question is more about how to assign a variable from one wrapped sObject Map from another.
..........
for(DeviceDisplay dev:deviceDisplayMap.values()){
if(CurrentSelectionMap.containskey(dev.proxy_adev.id)){
dev.selected = true; //THIS WORKS
dev.devicenotes = CurrentselectionMap.get(dev.proxy_adev.id).devicenotes; //THIS WORKS
//This is were I get lost. Is this possible?
dev.proxy_adev.put('request__c' , CurrentSelectionMap.get(dev.proxy_adev.id) ????????? get('request__c'));
.......
Map<ID,DeviceDisplay> DeviceDisplayMap
Map<ID,DeviceDisplay> CurrentSelectionMap
public class DeviceDisplay {
boolean selected {get;set;}
string DeviceNotes{get;set;}
.....
Wrapper Class DeviceDisplay (sObject dev){
selected = false;
sObject proxy_adev = dev;
......
}
After reading more about collections I figured it out. I needed to just step back and think about it. Made it harder than it needed to be.
dev.proxy_adev.put('request__c' , CurrentSelectionMap.get(dev.proxy_adev.id).proxy_adev.get('request'));