function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kool_RudKool_Rud 

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;

......

}

 

 

 

 

 

 

 

 

Kool_RudKool_Rud

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'));