You need to sign in to do that
Don't have an account?
SFDC 18
Error: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Zone__c.Name__c
Hi
I got this error when i tried to execute the below code in anonymous window
I got this error when i tried to execute the below code in anonymous window
public class NoofMaleAgents { public NoofMaleAgents(){ for(zone__c z : [SELECT Id,No_of_Male_Agents__C FROM Zone__C]){ z.No_of_Male_Agents__C = [SELECT count() FROM Agent__C WHERE Gender__C =: 'Male' AND Zones__C =: z.Name__C ]; upsert z; } for(zone__c z : [SELECT Id,No_of_Female_Agents__C FROM Zone__C]){ z.No_of_Female_Agents__C = [SELECT count() FROM Agent__C WHERE Gender__C =: 'Female' AND Zones__C =: z.Name__C]; upsert z; } } }
All Answers