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
Suzanne TimmerhansSuzanne Timmerhans 

Get fatal error on field in Apex Class extension

Get this fatal error when run VFpage due to problem with extension:
14:16:49.0 (69545363)|FATAL_ERROR|System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Training_Class__c.Sign_up_Deadline__c Class.IAC_Lobby_Day_Extension.<init>: line 142, column 1

Line 142    isinPast=(course.Sign_up_Deadline__c < date.today()? true:false);

When run VF page get authorization request for Guest User - although no such authorization is indicated in code.
 
Saravanan Gengan 9Saravanan Gengan 9
Sign_up_Deadline__c this field is not used in the SQOL query which is used to assign the values to the variable "course". 
Suzanne TimmerhansSuzanne Timmerhans
Thanks for the information – I will share it with the Support person working on the issue. And I will look into documentation re: SOQL query, etc. so I might someday be able to handle these issues myself.
Suzanne TimmerhansSuzanne Timmerhans
The field Sign_up_Deadline__c is a field from the Object Training Class - which is referenced in the extension class for the Lobby Day as 'course'.  The exact same phrase and code appears in another extension for Registration carries the same 'course' designation and that is working perfectly fine.  Also, the Lobby Day - VF page and extension were working fine as late as December 13th - since two registrations are recorded on that day.  Is the SOQL object specific or Apex class specific?  I saw some old posting about a similar (?) problem and the work around to add code to indicate hidden field.  I really need to get this working and the Salesforce Support seems to be going nowhere - any suggestions?

Line 142 from the IAC_Lobby_Day_Eextension:  isInPast = ( course.Sign_up_Deadline__c < date.today() ? true : false ) ; 
Line 98 from the IAC_Register_Extension:           isInPast = ( course.Sign_up_Deadline__c < date.today() ? true : false ) ; 

Used to ensure that the registration is not occuring after the cut off date.