Custom script not working for child table

Hi Experts ,

My custom script is not working for child table , please help :


frappe.ui.form.on("Customer TC", "refresh", function(frm, doctype, name) 
		cur_frm.get_field("percnt_carbon_min").get_query = function(doc, cdt, cdn) 
			var item = frappe.get_doc(cdt, cdn);
			var c = " ";
            if (item.customer_tdc) c=item.customer_tdc ;
            return { filters: {'customer_tdc': c}} 

Are you placing your custom scripts in the parent doctype’s custom script location?

For example, a fetch for the ‘sales order item’ child table would be located in the ‘sales order’ custom script folder

Also, format your codes using the preformatted text option, it looks like </>

Also, is “Customer TC” a DocType?

Thank you for responding , Yes customer Tc is a doctype and I am placing the custom script for the child table inside the child table custom script location and not in the parent doctype ? Should I put that in parent doctype custom script location ?

Yes, it seems that you always have to have the custom script in the parent doctype to work.

1 Like

Sir yes , it solved my problem . Thanks a lot for helping . You saved my day.

1 Like