How to filter Link field in Child Table when another linked field selected on Parent form

Hello guys.
I need help on the script to filter link child table field when a link field on parent doctype selected.


frm.set_query("cildtable_fieldname", "childtable_name", function (doc, cdt, cdn) {
			return {
				filters: {
					client_id: frm.doc.customer,
					billing_to_id: frm.doc.billing_to_id

how do i handle the link field on parent doctype? it needs to get selected before the child table field will be filtered