+ Start a Discussion

Phone data type displaying as "Exponential nbr" in Apex

I have the following code:


Sales_Organization__c slsOrg= [    Select  SLS_ZONE_MGR_FULL_NM__c,
	                           From    Sales_Organization__c s
	                           where   Market__r.Market_ID__c='38'
	                           and     SLS_ORG_LVL_NR__c='Z'
                                   and SLS_ZONE_CD__c='313'];
String phoneNbr = 'Phone:'+slsOrg.SLS_ZONE_MGR_PHON_NR__c;


 In my debug Log I see this:




Sales_Organization__c.SLS_ZONE_MGR_PHON_NR__c is defined as a "Phone" Datatype in the Custom Object. What am I missing here? I'm concatenating a CustomLabel to phone value in an apex controller and then displaying to the user in a visual force page.






Phone fields are text strings, not numeric fields. The debug log doesn't change strings into exponential format (though really long strings get cut short and an elipsis stuck on the end of them). You created your import file in Excel, probably with a column with of about 12.00, and saved it to a CSV file, then used that file as your import, either through the data loader or import wizard. Unfortunately, long numbers without any punctuation turn into scientific notation fields in Excel, and when you save it that way, the number you see on the screen goes into the CSV file verbatim.


Check your record in Salesforce, you'll see that the debug log is correct, and Excel has conveniently converted your phone numbers into useless gibberish.