Payment Entry: How to Fetch Exchange Rate from Parent into Deduction Table

Hi Guys, I want to fetch a figure/amount from the Parent into the Child Table.

The Payment Entry doc (Parent) has the source field, Exchange Rate (source_exchange_rate):

I want to fetch the value in this field into a custom field Exch. Rate (exrate) in the child table (deductions):

As you can see the Exch. Rate custom field in the child table is not updated automatically when I add a row. The custom script below does not seem to work:

//Fetch Exchange Rate value from Payment Entry parent into Payment Entry Deduction child table

frappe.ui.form.on(“Payment Entry”, “validate”, function(frm, cdt, cdn) {
var tbl = frm.doc.deductions || [];
var i = tbl.length;
var child = locals[cdt][cdn];
while (i–) {
if(frm.doc.deductions[i].exrate !== 0) {
frm.doc.deductions[i].exrate = frm.doc.source_exchange_rate;
frm.refresh_field(“deductions”)
}
}
});

I will appreciate your kind assitance.