+ Start a Discussion
tgganeshtgganesh 

Invalid field exception

Hi,

 

I am trying to fetch value from custom object, it is giving me invalid field exception.

 

Please tell me where am doing mistake. here is the code.

 

At_Risk_Request__c dynObject = new At_Risk_Request__c();
                    
dynObject= mapMainObjectData.get(AtRiskRecords.Id);                  
                      system.debug('GlobalREgion+++++'+String.valueOf(dynObject.get('CustomerAccount__r.Global_Region__c')));

 CustomerAccount is a Parent object of At_Risk_Request object. i am trying to access CustomerAccount field.

Bhawani SharmaBhawani Sharma
Make sure to add object instance before using the fields like in your debug:
CustomerAccount__r.Global_Region__c
use
objInstance.CustomerAccount__r.Global_Region__c