Link filter issue

i have 2 doctype … example first doctype name is = Employee. employee has two field[ name , and area]
2nd doctype name is =Task , aslo has two field[employee_name,and Visit_area]
now i connect two doctype with Link , when i select Employee name from Task doctype then show pre saved employee name… now i want a filter , from Task doctype if i select Visit_area then show which employee avaliable on the area… Because i already save name and area in Employee doctype. so in Task doctype if i select Visit area then show only spacific employee name which i already saved in Employee daoctype… how to do the filter Link , please advice me … Thank you.

@Al_Adnan_Mehedi try this code .

frappe.ui.form.on("Task", {
visit_area: function (frm) {
     if (frm.doc.visit_area){
		frm.set_query("employee", function () {
			return {
				filters: [
					["Employee", "area", "=", frm.doc.visit_area],
				],
			};
		});}
}
})
1 Like