Set value in child table

Hi, i have a problem.
In my Customer doctype, i have child table named “Customer Credit Limit”.
in the child table there are 3 fields:

  • Brand
  • credit limit
  • available credit limit
    So I need when i input the “credit limit” amount, it will automatically fill in the “available credit limit” field. Anyone can help me with this?

Please check the syntax:

i’ve tried but the available credit limit value doesn’t change

Please again check your field name and doctype name in the script.

frappe.ui.form.on(“Customer Credit Limit”, {

avaiable_credit_limit: function(frm, cdt, cdn){
   var d = locals[cdt][cdn];
   frappe.model.set_value(cdt, cdn, "available_credit_limit", d.credit_limit);

i use this code, is something wrong with my code?

spell mistake

ohh thanks. but i have second problem. when i sumbit sales invoice i need to decrease the available credit limit based on submitted sales invoice. can u help me?

That for, you have to develop the server script.