Pirmary ID showing in link field

Hi Expert,

How can I exclude showing primary ID in link filed:



Hello, I believe you are doing this on a DocType you created.
If so, you can easily achieve it by going to your DocType’s View Settings and enable the Show Title in Link Fields option.

Hope this helps

Show Title in Link Fields is enabled. But it shows also auto increment primary ID.

You cannot remove the primary ID. What will you do if there are duplicate employee names? How will you know who’s who?

If you’re sure that the names will be unique, why not just give the name as the primary ID? (Or a variation of the name and a numeric series?)

But any way to hide it? Because primary ID is meaningless to show for the user. I know it is important from DB point of view.

I’m saying from the user’s point of view as well… If there are two employees with the same exact name, and you don’t show the unique ID, how will I (as a user) know who’s who?

If you still want to do this, then set_query with return of a list of employee names should work. (Though I doubt the duplicate names would show up properly.)

Agreed, it would be a nice feature to (optionally) omit the primary key from appearing in a link field, especially in cases where it’s a meaningless value to the end user and might just confuse them. Perhaps a field could be added on the doctype next to the ‘Show Title in Link Fields’ that was something like ‘Omit Id in Link Fields’.

In those use cases for doctypes where duplicate titles exist and the primary key would be helpful to distinguish them, this option could be skipped. Worth a PR?

1 Like