We have a field on the Account object that is defined as Number(15, 0). We send this field via a soap request to some middleware.

Before we send the value we are changing it to a string using the toString() function. Sometimes the soap request will send the scientific notation for the data in the field.

I have not been able to find any rhyme or reason to it. I thought that if we reached a large enough value in the field it would always convert to scientific notation but that is not the case. What can I do to normalize the behavior of this function?

  • None of the Number types in Apex (Long, Double, Decimal, Integer) have a toString method.
    – Adrian Larson
    Commented Aug 9, 2016 at 17:33

1 Answer 1


Have you tried using the toPlainString() method?

Decimal myDecimal = 12345.6789;

System.assertEquals('12345.6789', myDecimal.toPlainString());

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .