+ Start a Discussion

How to check a null value on date field?



I have a custom date field last_Modified_date__c on Account object. I am writing a before upate trigger, and some part of the code must execute only when last_Modified_date__c != NULL. I get the error 'Invalid field for Sobject Account when i refer the last modified field. How can I overcome this situation and check the null vlaue in the trigger for date field?


Thank You in advance for your help.



Make sure you check the api name of the field on account and that you're referencing it correctly. Also, I'm not sure the reasoning behind a custom last modified date field. All objects have a standard LastModifiedDate field that you could use if the logic is simply checking when the record was last modified. Either way, your syntax is correct for checking a null date field, you just don't have the correct reference to the field.


Hi, I dont think the error has anything to do with the null check. Your null check is fine. Please check the API name of the field and the one used in your trigger. Thee might be a typo somewhere.