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
King KooKing Koo 

Record Name - Text vs Auto Number?

Hi guys

 

Just want to know if you guys have any preference as to when to use Text as the record name and when to use Auto Number?  The limitations that I see of Text is that 1) it can be at most 80 characters long, and 2) Salesforce doesn't guarante uniqueness of the field.

 

However, if I use Auto Number, then I have some other problems.

 

For example, let's say I have an object called Work Unit, and because the text can be over 80 characters long, I use Auto Number as the record name, and then create a field called Description.

 

I have another object called Sub Work Unit that points to Work Unit.  When I fill out the edit form for Sub Work Unit, I can't type the Work Unit's description to do a lookup, I can only type the auto-number of the Work Unit in order to do a lookup and that is causing me a lot of pain.  What am I doing wrong?

 

Any suggestion is greatly appreciated.

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
Santhosh KumarSanthosh Kumar

Name field of an object has special attention in Sfdc. It is automatically indexed and whenever you display its relationship field in other object layouts, name is displayed with a link to that id. If you override it to be Autonumber, then that number is what always shows up. I don't think you can change that behaviour in standard screens. However, in VF page you could display your text field instead of Name field.

All Answers

JitendraJitendra

Hi,

 

Name field is mandatory and auto indexed in salesforce and there are cases where we dont need the name but it cant be empty thats why auto number is there.

 

For example : Lets say payment is detail record of the opportunity. Payment cannoy have name rather amount or type of payment is important and in that case every payment must have unique auto number.

 

However, if you like to search name in lookup then dont use the auto number.

 

I hope you got your answer.

King KooKing Koo

Hi there

 

I think I'm almost there.

 

It's just that I have an object that needs to store strings that are over 80 charaters long, so I can't really use text.  I have to use auto-number that way.

 

And that when I do a lookup to this field, even though I have changed the page layout so the lookup dialog window shows the long text, once I pick the value, the auto-number instead of the text shows in the textbox that I called the lookup from.

 

I would've much rather display the text.

 

Is it doable?  Or is it doable only if I'm using VF and Apex?

 

Thanks

 

Santhosh KumarSanthosh Kumar

Name field of an object has special attention in Sfdc. It is automatically indexed and whenever you display its relationship field in other object layouts, name is displayed with a link to that id. If you override it to be Autonumber, then that number is what always shows up. I don't think you can change that behaviour in standard screens. However, in VF page you could display your text field instead of Name field.

This was selected as the best answer
King KooKing Koo

Yeah, that's what I expected....   THanks!