You need to sign in to do that
Don't have an account?
Sujendran Sundarraj 8
Annual revenue throws error : “Illegal Integer” with char 1000000000 and above
In my below code I am getting error as Illegal integer.
at the last two if else only.
Please help to fix this issue. Thank you.
public void refedgeAnnualrevenue(list<Account> newAccts){ for(Account ac : newAccts){ if(ac.AnnualRevenue >= 0 && ac.AnnualRevenue <=49999999){ ac.RefEdge_Annual_Revenue__c ='< $50M'; } else if(ac.AnnualRevenue >= 50000000 && ac.AnnualRevenue <=499999999){ ac.RefEdge_Annual_Revenue__c ='$50M-$500M'; }else if(ac.AnnualRevenue >= 500000000 && ac.AnnualRevenue <=999999999){ ac.RefEdge_Annual_Revenue__c ='$500M - $1B'; }else if(ac.AnnualRevenue >= 1000000000 && ac.AnnualRevenue <=4999999999){ ac.RefEdge_Annual_Revenue__c= '$1B - $5B'; }else if(ac.AnnualRevenue >= 5000000000){ ac.RefEdge_Annual_Revenue__c ='> $5B'; } } }
at the last two if else only.
Please help to fix this issue. Thank you.
If you want to use a large constant value in apex you can either do as your latest example and make it a Long, use Double.valueOf('2147483648'); or any other way besides an integer literal.
There is no documentation that exists specifically since it's such a narrow use case, but the last sentence here confirms that Number fields are of a Decimal type.
Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you