Terms and conditions related to customers

I added to the application a new field “terms and conditions” in the customer doctype. I would like to know if it is possible to display these terms automatically when choosing the customer. I wrote a script but it did not work, can anyone help me?

That’s the script i wrote in:
Doctype : Sales Order
Script :

frappe.ui.form.on(“Sales order”, “refresh”, function(frm, doctype, name)
cur_frm.get_field(“terms_and_conditions”).get_query = function(doc, cdt, cdn)
var item = frappe.get_doc(cdt, cdn);
var c = " ";
if (item.customer_name) c=item.customer_name ;
return { filters: {‘customer_name’: c}}


try cur_frm.add_fetch('customer', 'terms_and_conditions', 'tc_name')

1 Like

Dear @makarand_b ,
Thank you for your reply it works well.