Client script on child table not able to find my custom field

I’m trying to update a custom field in the ‘Asset Repair Consumed Item’ child table in the Asset Repair Document when the consumed_quantity field is set.

This is my script.

frappe.ui.form.on(‘Asset Repair Consumed Item’, {
consumed_quantity: function(frm, cdt, cdn) {
msgprint(“Script is triggered”)
var d = locals[cdt][cdn];
frm.refresh_field(“available_quantity”)
frm.set_value(‘available_quantity’, “hello world”);
}
});

The script executes, but it says available_quanity field does not exist. I’ve already added it as a custom field in the Asset Repair Consumed Item DocType. What am I doing wrong?

Hi @thelahera,

The problem within these two lines.

So please check the syntax.

frappe.ui.form.on("Asset Repair Consumed Item", {
    consumed_quantity: function(frm,cdt,cdn) {
        var d = locals[cdt][cdn];
        frappe.model.set_value(cdt, cdn, 'available_quantity', "Hello World");
    }
});

Thank You!

Thank you so much