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

how to test blank value for Integer

Hi All,


Is there any way to test blank values for Integer fileds, for Strings fields

if( Str == '') or Isblank(Str) ...

Any help must be highly appreciated.

Thanks in advance !

Salesforce Hidden FactsSalesforce Hidden Facts
You can convert the integer value to string value by Using String.ValueOf function
and after that test this converted string for blank value as you are doing .

you can check like this for integer


integer i;




Thank you for the work around. Is there any standard methods ?

Thank you for the response   . It is checking only null values, not blanks


are using in apex or formulas?


can yoy try this


if(i==null || i=='')

I am using in Apex only , and i == '' giving compilation Error

we cannot use i==''. As this is for string literals.



Integer Type data can only contains NULL value , if there is no Data.
because NULL is the default value of a String. There is no standard method to check ''(blank) value for Integer field.

If you need it , then you can check

Intege i;
If(i == NULL || (i != NULL && String.isBlank(String.valueOf(i)))){