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
Phuc Nguyen 18Phuc Nguyen 18 

test class update field error

Hello All,
I have a test class where I am updating a checkbox.  In the Apex Class this would create 2 new records.  The tets class fails when I perform the update.  The record I am updating exist since I checked in an assertion so not sure why I am getting an error:
 Attempt to de-reference a null object.
Would that tyupe of error message be due to information missing in my test data or the creation of the neww records?
Cheers,

P

Vishwajeet kumarVishwajeet kumar
Hello,
"Attempt to de-reference a null object" error comes when we try to access some fields or values/data from a variable which is null.
Error should also provide line number and stack trace which can help in locating null variable.

Thanks