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
Marco_MaltesiMarco_Maltesi 

make the object name read only!!

hello ,

Please can any one answer my question: is it possible to change the the fild "Name" of an object to read only. if yes, how can i do it?

thanks, thanks thanks

HariDineshHariDinesh

Hi,

 

Do you want to make that field read only for System Administrator Profile..?

 

If yes, as it is standard filed we can’t Edit the properties of that field.

 

(However this field is not editable for other Profiles)

JitendraJitendra

Hi,

The standard Name field in any Object is required and hence you cannot mark it as Readonly, neither by Field level security nor by Pagelayout.

If the type of Name field is Autonumber then by default it is Readonly.

 

You will need to take the help of Trigger or Validation rule if you are seeking some business specific requirement on this field.

SamuelDeRyckeSamuelDeRycke

Why do you want to have it readonly ?

 

The name field is a rather important field, its the main identifier for a record for users (where I is more a technical identifier).  

 

There is a possibility to visually remove or limit the Name field with javascript, but you will still need to provide a value in it from javascript and is not really that good practise in most cases. If you let us know what you are trying to achieve, maybe we can assit you with a better alternative approach to the unerlying requirement.

Marco_MaltesiMarco_Maltesi

i need to hide the field name because i use a workflow to put values in.

the idea is to not be forced to write values in the name field to save record.that s all.thanks

hemantgarghemantgarg

you can go by validation rule, easiest approach.

Steve Cox 18Steve Cox 18
I'm replying to this 10 year olds thread with a solution - because I've been searching for an identical fix. We use apex to set the name of a custom object on saving so would want to make the name field to display as ready-only and to have help text to clarify this. Both cannot be added to the name field via setup.

The solution is to create a formula field that just copies the name of the object record - and also set the help text there. Before, you still could not remove the mandatory name field from the page layout but you can modify/create a lightning page layout to do this:

1. Remove the standard record details component (or do this last so you can use this as an aide-memoire)
2. Add a tabs component, remove the details tab and add a custom tab called 'details'.
3. Add the related lists component to the 'related' tab 
4. Add a 'field selection' component to the details tab (on the left, it's under fields rather than components) and name it 'mandatory fields'
5. From the fields list, drag over all the same fields but replace the standard name field with the custom formula field