I'm importing all my data via dataloader and have the Object's record field setup as a "Name" (text). The problem is that the name generated by salesforce is a long ugly string (ex: a0mc0000003bNBi). This string is also required to be listed on related lists, which is rather annoying.

I understand that this is necessary in order for each record to be unique; however, can the display name be changed to something more user friendly (for example, by specifying another 'company name' field (or whatever) so that the clickable record name is now the name of a company?

up vote 2 down vote accepted

The system does this for you automatically if you omit the Name field in your import (or if it's blank). If you create a Name field and give it values, you'll see those instead of the Record Id in the name field (and consequently lookup fields and other places).

  • Sorry, I don't understand. Could you provide a bit more detail? My understanding was that the Name field could not be omitted as this is the unique identifier for that record - I though the "Name" and "Record ID" were synonymous. In fact, when I load data in via dataloader, it automatically provides values for this field. Are you suggesting that there is some way to omit the name field and/or force it to display something else? – Bob Jordan Dec 4 '17 at 7:16
  • @BobJordan Name doesn't have to be unique, and is not the unique identifier for the record. Id is generated by the system and automatically assigned to each record upon creation. Name is required in the UI, but can be omitted when using an API, thus causing it to take the value from the record Id. Name cannot be blank in the database, because the system does require it, but the API cheats a bit by allowing the record Id to be put in the Name field automatically. You can't omit it, but you can load a value into Name just as you would any other field; it's a text field 80 characters wide. – sfdcfox Dec 4 '17 at 8:29
  • That's super interesting - thanks for the explanation and tip. I don't suppose salesforce will auto-truncate field values that are over 80 characters long will it? Or is there some way to get around that potential situation? – Bob Jordan Dec 4 '17 at 20:28
  • @BobJordan "Maybe." There's an attribute called "allowFieldTruncation" that can be set on an API call to allow truncation. When true, the field is limited to 80 characters, and when false, causes an error on the row instead. I think the Data Loader allows you to specify if you want to allow truncation in the Settings screen. – sfdcfox Dec 4 '17 at 20:30
  • Thnaks a bucnh for the answers. I ended up just writing a small python script to strip out anything beyond 80 characters :) The solution as you posted works though; creating a new column in the source CSV called "Name" and then including "Name=Name" in the .sdl file causes dataloader to automatically populate that string with human-readable text. – Bob Jordan Dec 6 '17 at 21:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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