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
XXXXXX 

Defaulting the Name Field on a Custom Object

I have a custom object with the standard Name field on it. I don't need or want this name field, but I cannot remove it from the layout, cannot remove it from the list view, cannot make it read-only, cannot make it invisible, and cannot make it not-required.

 

Since I'm stuck with it, I figure I will set a default to it and stash it down with the Created By field so that the user won't be troubled by a field she cannot use.

 

My plan was to create a custom URL button and set the default that way. I have sample code that works pretty well. The sample code, however, requires that you know the ID of the field you want to default.

 

How do I find the ID for a Name field? It doesn't show up on the status bar when I hover over the link.

 

TIA,

 

John

Best Answer chosen by Admin (Salesforce Developers) 
shillyershillyer

Hi John,

 

If you do not want to use the standard name field, you can turn it into a auto-number, this way it's auto-populated. Then you can remove it from page layout.

 

Hope that helps,

Sati

All Answers

shillyershillyer

Hi John,

 

If you do not want to use the standard name field, you can turn it into a auto-number, this way it's auto-populated. Then you can remove it from page layout.

 

Hope that helps,

Sati

This was selected as the best answer
ABCDEFGHIJKLMNOABCDEFGHIJKLMNO
Many thanks, that solved my actual problem. Just for the record, is there any way to actually default the Name field?
shillyershillyer

Not that I'm aware of, but if you wanted the value to always be uniform, you could use a workflow field update to update the name field after save.

 

Best,

Sati