4

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?

  • 1
    This isn't a change from Summer '14 to Winter '15. There's no mention of this kind of limitation in the docs. A lot of the practice exams available online have errors in them, so if an answer seems really wrong, it probably is. – shannonsans Oct 27 '14 at 21:33
5

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.

| improve this answer | |
1

There is a question about how to study for the exam and one of the answers states:

Finally, I always caution people about practice exams. Because of the always changing nature of the platform (and by extension the certification exams), that person who wrote those practice questions a year ago, may have been spot-on correct then, but a year later they may be out of date. Unless the questions you are using list the release they were written for, don't rely on a successful practice exam to tell you you will pass our certification.

I have heard from many different sources that it isn't the best idea to use the practice exams. If you don't think the practice exam is correct, research the question on your own, for example this is what the docs have to say about best practice for changing field types:

Consider the following before converting fields: Only convert custom fields for which no data exists or you risk losing your data. Changing the data type of an existing custom field can cause data loss in the following situations:
- Changing to or from type Date or Date/Time
- Changing to Number from any other type
- Changing to Percent from any other type
- Changing to Currency from any other type
- Changing from Checkbox to any other type
- Changing from Picklist (Multi-Select) to any other type
- Changing to Picklist (Multi-Select) from any other type
Currently defined picklist values are retained when you change a picklist to a multi-select picklist. If records contain values that are not in the picklist definition, those values will be deleted from those records when the data type changes.
- Changing from Auto Number to any other type
- Changing to Auto Number from any type except Text - Changing from Text to Picklist
- Changing from Text Area (Long) to any type except Email, Phone, Text, Text Area, or URL

  • If data is lost, any list view based on the custom field will be deleted, and assignment and escalation rules may be affected.
  • If you change the data type of any custom field that is used for lead conversion, that lead field mapping will be deleted.
  • If you change the data type of a custom field that is set as an external ID, choosing a data type other than text, number, or email will cause the field to no longer act as an external ID.
  • The option to change the data type of a custom field is not available for all data types. For example, existing custom fields cannot be converted into encrypted fields nor can encrypted fields be converted into another data type.
  • In Salesforce Knowledge article types, the file field type can't be converted into other data types.
  • You cannot change the data type of a custom field that is referenced by a Visualforce page.
  • Changing a custom field type may require changing a large number of records at once. To process these changes efficiently, your request may be queued and you may receive an email notification when the process has completed.
  • Before changing a custom field’s type, make sure that it isn’t the target of a workflow field update or referenced in a field update formula that would be invalidated by the new type.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.