Update set_query based on child table event

Hi all

I’ve got a child table for which the set_query applied to the field “location” needs to change based on the information selected in “product”.

The code below works for the first row in the table, however doesn’t update to the new product selected for subsequent rows. In the image you can see that the initial set_query is still active.

I have a feeling that using a child table event trigger is needed, however I’m not sure how to go about this. Any help would be greatly appreciated.


// Filter Product Details child table
frappe.ui.form.on("Lease Agreement", "onload", function (frm) {
	frm.set_query("location", "product_location", function () {

		for (let i in frm.doc.product_location) {
			return {
				"filters": {
					"status": "Inactive",
					"item_code": frm.doc.product_location[i].product

Just giving this one a bump. Any suggestions would be appreciated. Cheers!

Found a solution to this here:


Thankyou for this

1 Like