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
Anand@SAASAnand@SAAS 

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,
	                                   SLS_ZONE_MGR_EMAIL_TXT__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'];
System.debug('>>>>>>>>>>>>>>'+slsOrg);
String phoneNbr = 'Phone:'+slsOrg.SLS_ZONE_MGR_PHON_NR__c;

System.debug('>>>>>>>>>>>>>>Phone:'+phoneNbr);

 In my debug Log I see this:

 

10:01:23.055|USER_DEBUG|[14]|DEBUG|>>>>>>>>>>>>>>Phone:Phone:4.20725E+11

 

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.

 

 

 

 

sfdcfoxsfdcfox

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.