[SalesForce] Converting a field type from number to text

I'm doing a practice exam to prepare for my DEV-401 Salesforce Developer certification exam.
One of the questions is:

A developer changes a custom field type from Number to Text with a field length of 2. which of the following statements is true?

I picked:
All the values in the number field will be converted to text

It's saying my answer is incorrect and it should be:
Numbers less than 2 characters in length will be converted to text and numbers greater than 2 characters in length will be converted to text and truncated

I disagree, I tested it in Salesforce, I created a custom field of type Number with length 6. Created a record of the object and then modified the field type to Text with length of 2. I reopened the record and it's still has the 6 digits, the only different is that instead of 123,456 it's now 123456 (no comma).

Could it be that both answers are correct depending on which Salesforce release we are testing against? I tested against Winter 15.

If SF does changes like this, why do do they ask such questions on exam if in a few months what is correct now could become incorrect?
Shouldn't they focus on fundamentals instead?

Best Answer

I reopened the record and it's still has the 6 digits, the only different is that instead of 123,456 it's now 123456 (no comma).

The reason is that when you truncate a field on type conversion, the underlying data isn't updated until each record is saved. If you inline-edit the record and save without shortening the number, you'd get a save error. If you had clicked Edit at that point, you'd see just 12 in the Text field.

(Incidentally, you don't get the comma because the comma comes from number formatting, determined by your locale.)

So, IMO, both suggested answers (as recounted here) are a little misleading. (Did this practice exam come from Salesforce? If so, I'll try to follow up.)

Could it be that both answers are correct depending on which Salesforce release we are testing against? I tested against Winter 15.

Nope, it's always worked this way.

Related Topic