Link field, does not bring data

Good morning, I have created a custom field in the Customer form, with which to have a customer identification number.

I want to bring the information from this field to the Quotation form, every time I select the customer, for this I created 2 more custom fields in the form, one of type link field, where I link Customer and another field where I try to bring the data from the customfield of Customer.

However, the field linked to Customer (link type) shows the names, but the field that should bring the specific information from the Customer custom field does not show anything.

What am I doing wrong in the process?
Thank you very much in advance, sorry for the wording but I don’t speak English.

Hola! @Maderas_Corozal:

Quotation has not a “normal” customer link field … because a quotation can be made for customer, leads, etc … So it uses “Dynamic Link” (field “Quotation to”). I think automatic fetching is not possible in that case.

Create a client script for Quotation (and enable it) with this code:

frappe.ui.form.on('Quotation', {
	party_name (frm) {
		if (frm.doc.quotation_to == "Customer") {
            frappe.db.get_value("Customer", {"name": frm.doc.party_name}, "custom_dnic", function(value) {
                frm.doc.custom_dnil = value.custom_dnic;

Here, when you select a customer, customer dnic is asigned to quotation dnil field.
Espero haberte ayudado :wink:


Thanks, it works perfect!!!