Activity Forums Salesforce® Discussions de-reference a null object

  • Parul

    Member
    August 30, 2018 at 12:04 pm

    Hello Chanchal,

    This error is caused by a line of code that is trying to use an object that has not been instantiated, or an object’s attribute that has not been initialized.

    NOTE: If the field Site was left empty, it will generate the error message as well.

     

    Thanks.

    Parul

  • madhulika shah

    Member
    September 6, 2018 at 6:59 am

    Hi Chanchal,

    This is the equivalent of the Null Pointer Exception in Java.

    This error is caused by a line of code that is trying to use an object that has not been instantiated, or an object's attribute that has not been initialized.

    Hope this helps.

    Thanks.

  • shariq

    Member
    September 14, 2018 at 10:17 pm

    Hi,

    Mostly this error occurs when you have not initialize the list/set/map etc and using their methods.

    When you query any sobject with no records and then using its fields somewhere in code without null or empty check

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos