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
AutobatAutobat 

Strange Error

OK, it's late in the week and i have to admit that I'm very tired so I'm hoping that I'm just going a little crazy!

Code compiles but sends out an error when run of : System.TypeException: Invalid integer: 1

The error looks mightily strange to begin with as I have become accustomed to 1 being an integer for sometime now.

Never the less, i have split the into seperate stages (please no comments about how i could just parse it in one line, i know) and we still get an error, now im going to leave this one here and go to the pub as i mentioned before its been a long week and i really fancy a nice cold beer!

 

Oh, nearly forgot, License_Duration__c is a numeric in the database and so is retrieved as a double.

 

double dDuration = sPCC.Product__r.License_Duration__c;
integer iDuration = integer.valueOf(dDuration);
sLicense.Expiry_Date__c = sLicense.Start_Date__c.addMonths(iDuration);

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
integer iduration = dduration.intValue();

All Answers

SuperfellSuperfell
integer iduration = dduration.intValue();
This was selected as the best answer
AutobatAutobat

Thank you, that's what I needed!  I believe my brain is officially burned out for the week.

 

Enjoy the weekend!