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
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