Link Field "Title" not showing in Sales Invoice when fetched from Customer

Hi everyone,

I am having an issue with how a custom Link field displays data when fetched from the Customer DocType into a Sales Invoice in ERPNext v16.

The Setup:

  1. Custom DocType (Tax Office):

  2. Customize Customer DocType:

    • I added a Link field pointing to the Tax Office DocType. This works perfectly; it shows the Name (Title) instead of the ID.

  3. Sales Invoice DocType:

The Problem: When I select a Customer on a Sales Invoice, the field vergi_dairesi fetches the ID of the Tax Office record instead of the Title (vergi_dairesi).

Even though “Show Title in Link Fields” is active on the source DocType, the fetch command seems to ignore the display title and grabs the raw database ID.

Question: How can I ensure the Sales Invoice fetches the “Title” (Name of the office) or displays the Link correctly as it does on the Customer page?

Thanks in advance!

Merhaba, eğer doğru anladıysam ben kendim senaryomda bunu şöyle çözmüştüm:
Her şehir bir RMTM-e bağlı (RMTM table-nın içinde de sadece RMTM adı isimli bir field var)

Bende başka bir table-da şehir ismini çağırdığımda RMTM-i çağırmak istiyorum.
RMTM ve Şehir ismine ilave olarak 3-cü bir (readonly, hidden) field-de RMTM ismini fetch only-le çağırıyorum.
Normalde Link-ler bize ismi gösterselerde aslında gelen ID, bu şekilde fetchonly-le RMTM adını çağırıyorum.
Ve ben RMTM-i direkt fetch etmek yerine readonly olan field-i fetch edip sorunu çözüyorum.

image

image1257×507 11.6 KB

Cevap için teşekkürler. Öncelikle benim örnek tabloyu vereyim

Vergi dairesi listesini içeri aktarırken, her vergi dairesi için sistemdeki benzersiz ID numaralarını kullanıyorum. Ancak ‘Selçuk VD’ örneğinde olduğu gibi, aynı isimli vergi daireleri farklı şehirlerde (örneğin hem İzmir hem Konya) bulunabiliyor. Hem vergi dairesi ismi hem de şehir ismi ‘Unique’ (benzersiz) olmadığı için, Sales Invoice üzerinde bu isimleri kullanarak bir ‘Fetch’ işlemi yapmak imkansızlaşıyor; sistem hangi ‘Selçuk VD’ kaydını getireceğine karar veremiyor.

Önerdiğiniz çözümü doğru anladığımı umuyorum ancak bir kısıtım var: Tablodaki diğer alanları (field) listeleyemiyorum, işlem yapabileceğim veri şu an için sadece ID alanı ile sınırlı.

I am importing my Tax Office list using unique system ID numbers as the ‘name’ (Primary Key). However, I’ve run into a significant issue with data fetching due to non-unique display names.

The Challenge: Tax Office names and City names are not unique in my database. For example, there is a ‘Selçuk Tax Office’ in İzmir and another ‘Selçuk Tax Office’ in Konya. Because these names are not unique, I cannot use them as a reliable reference for fetching data into the Sales Invoice. The system cannot determine which ‘Selçuk’ to pull based on the string alone.

The Constraint: I hope I understood your proposed solution correctly, but I have a limitation: I am currently unable to list or access other fields in the source table during this process. My data interaction is strictly limited to the ID (Name) field at the moment.

Since the ‘Title’ is not unique and I only have the ID to work with, how can I force the Sales Invoice to display the specific ‘Tax Office Name’ associated with that unique ID instead of the ID number itself?"

I am not sure this is what you are looking for but how about this:

If calling Selçuk V.D. is problem you can create a readonly title field and with a client script, script can write into it both field names like:

Selçuk V.D. - İzmir
Selçuk V.D. - Konya

Thanks. Script might work then. Do you have any example for scripts? Never done it before so no idea where to paste script :slight_smile:

You can use chatGPT for client scripts, this one is simple but for complex scripts you can use it

At below a simple join client script
Doctype Emekdaslar (Mean Employee)
Adı (First name)
Soyadı (Last Name)

And title is field name that both names will come together (You can use your own field names)
frappe.ui.form.on(‘emekdaslar’, {
emekdas_adi: function(frm) {
set_title(frm);
},
emekdas_soyadi: function(frm) {
set_title(frm);
}
});

function set_title(frm) {
if (frm.doc.emekdas_adi || frm.doc.emekdas_soyadi) {
frm.set_value(‘title’, (frm.doc.emekdas_adi || ‘’) + ’ - ’ + (frm.doc.emekdas_soyadi || ‘’));
}
}