Try ERPNext Buy Support Partners Foundation

Client-Side Code is not being executed

Hello Community,

I’m fairly new to client side scripting. I have an issue that my code is not being executed and need a hint in the right direction. This is how it currently looks like.

frappe.ui.form.on('repairs', {
        customer: function(frm) {
                console.log("Hello");
                customer_info = frappe.client.get(doc.customer);
                if (customer_info.customer_type === "individual") {
                        cur_frm.set_value("address", customer_info.address_line1)
                };
        }
});

So what is supposed to happen here is that on my repair form, whenever the “customer” field is modified, the code below is executed. I can see in the console that no “hello” is being printed so I assume the issue is there.

Regards,
ValS

  1. Check DocType name repairs, It may be with capitals.
  2. Do console.log(customer_info) and console_log(customer_info.address_line1) and see the F12 (developer console) to see what you get.
1 Like

How did I not see this?? You’re correct, my doctype should’ve been in capitals.