Table primary key

I created a new doctype in developer mode. when I link it in another docype in the suggested list appear the alphanumeric key, that is the value saved in the table under the column “name”, that correspond to the table primary key.

If i link a default doctype this not happen.

This is the result:

Instead for example, if I link doc “USER”,I can see in the list the email in bold and under it the full name of user.


How can i do this, in my example, how can I do the AISI field as primary key and show it in the box of the link?

You should try this.

Default doctype have naming field or naming series but when you create custom doctype it will automatically create hash for name if you wont specify name field or naming series.

Open that DocType where you can see all its fields

Just below the DocField table, you will find a Autoname where you can decide how do you wish to name the records that will be created - basically you can decided what field value or naming series do you wish to be taken as primary key’s value.

Say you want to set the field customer_name’s value as primary key (which actually the field name), then you write in that space = field:customer_name.

Remember, you are not going to decide which field is going to be the primary key, rather you will only get to decide what value this primary key field will be set to.

Perfect it works.

One question, so when I link a document in another Document, the list that appear in the space, shows always the table key in bold, or there is the possibility to show other fields?


bold ? may have to check and you will have to write custom query for that.

Check out in erpnext repo you will find many such examples.