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
kdmrkdmr 

Error Invalid Integer while using adddays method

Hi, I have been trying to do a calculation on the date type field when I keep encountering this error
double d = integer.valueof(mfrwdays);
integer i = d.intValue();
enddate = objassetconfig.MfrWarrantyStart__c.adddays(i);

where mfrdays is the value for a inputtext in the vf page. I have also tried to accept integer value directly from the string and still result with the same error. Require some help on this.

 

Thanks

KD 

 

werewolfwerewolf
First of all, why are you setting that value to a double and then back to an integer again?  Can you verify that mfrwdays is in fact a valid number, such that the double isn't coming up null or otherwise invalid?
kdmrkdmr

Hi,

I have a null value check for mfrwdays, if no value is entered it does not perform the enddate calculation. I tried using Interger i = integer.valueof(mfrdays) and was getting the error so tried using the intvalue() function. I am able to get the value for mfrdays in the debug logs but not for the integer or double variables. It is also checked to ensure that only numeric values are entered.

 

Thanks

KD