Hi Experts ,
My custom script is not working for child table , please help :
cur_frm.add_fetch('customer_tdc','percnt_carbon_min','percnt_carbon_min');
{
cur_frm.add_fetch('percnt_carbon_min','percnt_carbon_min');
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 </>
srinivasragav:
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}}
}
}
);
}
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