How to add custom script to child table?

I want to hide a field in child table.
In a new client custom script I click the “Add script for Child Table” button which select a child table and insert a script for the child table.
But it doesn’t affect anything.
It does work for the parent table.

//the parent:
frappe.ui.form.on('Delivery Note', {
	refresh(frm) {
		frm.set_df_property('is_return', 'hidden', 1);

//the child:
frappe.ui.form.on('Delivery Note Item', {
	refresh(frm) {
		frm.set_df_property('rate', 'hidden', 1);

Is there anything I should add to the code?
Thank you

Try this

frappe.ui.form.on("Delivery Note", {
	before_load: function(frm) {
		var df_rate = frappe.meta.get_docfield("Delivery Note Item", "rate",;
		df_rate.hidden = 1;
1 Like

Yes it works for the popup child-table form (when click that triangle on the right). No longer rate field above amount field.

Now how do I also hide it from the table view in the parent doctype?
I try to use df_rate.in_list_view = 0 doesn’t hide the column from the table view.

1 Like

It should hide from the grid as well, maybe you just need to clear cache using “reload” and then you should be fine.

No it is not hidden on the grid.
I have reload, bench clear-cache, change browser.


In my case I am trying to change the filter parameters in a child table but it’s not working. Here’s my script:

frappe.ui.form.on('Expense Claim Type', {
refresh(frm) {
 frm.set_query('payment_account', function() {

frappe.ui.form.on('Expense Claim Account', {
	refresh(frm) {
        frm.set_query('payment_account', function() {
			return {
				filters: {
					"is_group": 0,

Any ideas what I could be doing wrong

The below client script is correctly fetching data to Salary Slip doctype. However, the deduction/earnings are not updated based on the fetched field unless I press save button. Is there anyway that the deductions/earnings tables are refreshed when the field opt_in is updated?

frappe.ui.form.on(‘Salary Slip’, {
refresh: function(frm, cdt, cdn)
doctype:‘Lunch Mess Option’,
if(r.message !== undefined){



@flexy2ky i am stuck with the same issue rn.

Try using this

fieldname_of_parent_docs_variable: function (frm) {

    var schedule_due = frappe.meta.get_docfield(
      "Childtable Name" , // i.e., Sales Invoice Item

      schedule_due.read_only = 1;
      if (frm.fields_dict["fees"].grid.grid_rows.length > 0) {
        // Access grid_rows properties here
        frm.fields_dict["fees"].grid.grid_rows.forEach(function (row) {
 = row.doc.amount;

Hi @rahy

Did you find a solution ?

no I didn’t and haven’t