Activity Forums Salesforce® Discussions Can Boolean value be Null or not in Salesforce?

  • Anjali

    September 6, 2018 at 5:21 am

    Hi Shradha,

    Boolean must be constructed with a boolean or a String. If the object is unintialized, it would point to null.The default value of primitive boolean is false.

  • Parul

    September 7, 2018 at 6:10 pm

    Hi Shradha,


    Apex: Booleans can be null, unless you instantiated the Boolean to a true/false, you must check for null before checking whether it’s true or false.




  • shariq

    September 18, 2018 at 11:53 pm


    Additionally, there's a Boolean type, which can be true, false, or null, and can be used in Collections because it inherits from Object. If using the latter, the consumer need always check for null before checking true or false.

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos