Change value in child table filed based on change in parent document

I have child table called Facilitator and have filed called status and i have filed in the parent document called course_status i need when change value in course_status automatically update the value on status filed in the child table

i’m using this script but it’s not actual change the status only change it in document view

frappe.ui.form.on(“Event”,“refresh”, function(){

for (var i =0; i < cur_frm.doc.facilitator.length; i++){

if(cur_frm.doc.course_status == “Completed”){

cur_frm.doc.facilitator[i].status = “Delivered”

}

}

cur_frm.refresh_field(‘facilitator’)

});

Hi
try this,