+ Start a Discussion
Travis WrightTravis Wright 

APEX Code help - Check if Number field is Blank or Null

I have a trigger and have to change the logic a little check if a number field is Null. I have done some research and everything is telling me to use the IsNull Fuction and it keep getting the error below and Can't figure it out. I have the section of code that is giving me the issue. 

Error Error: Compile Error: Method does not exist or incorrect signature: IsNull(Decimal) at line 3 column 4

trigger AssignTerritoryType on Account (Before insert, Before update) {
    For (Account a :trigger.new){
if(IsNull(a.Fortune_1000_Rank__c) && (a.NumberOfEmployees >= 10000) && (a.Industry != 'Education')==True  ||
   IsNull(a.Fortune_1000_Rank__c) && (a.AnnualRevenue >= 800000000) && (a.Industry != 'Education')==True  ||
    a.Industry == 'Energy' ||
    a.Industry == 'Pharma/BioTech' ||
    a.Industry == 'Fed - Gov'  ||
    a.Fortune_1000_Rank__c <=650 )
    {
  a.Major__c=true;
  a.Mid__c=False;
  a.Inside__c=False;
  a.Inside_small__c=False;
    }
Best Answer chosen by Travis Wright
Sonam_SFDCSonam_SFDC
Try to use if((a.Fortune_1000_Rank__c == NULL)&&... instead of the ISNULL()

All Answers

Sonam_SFDCSonam_SFDC
Try to use if((a.Fortune_1000_Rank__c == NULL)&&... instead of the ISNULL()
This was selected as the best answer
jsnyderjsnyder
There's no isNull() method for the Decimal class.  http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_decimal.htm#apex_System_Decimal_methods