How apply filter in doctype

in ‘issue’ doctype i have one table field which is link to ‘person in charge’ doctype and in the ‘person in charge’ docrtype there is one field ‘technician’ which is link to employee now i want in the issue doctype in this table field show only those employee whose designation equal to ‘technician’

i have try script but not work
please help
frappe.ui.form.on(‘Issue’, {
onload: function (frm) {
// Apply filter to ‘custom_person_in_charge_technician’ field
frm.fields_dict[‘custom_person_in_charge_technician’].grid.get_field(‘technician’).get_query = function () {
return {
filters: {
designation: ‘Technician’
}
};
};
}
});

Hi @Rahul7218 try this method, add this in the refresh function.

frm.set_query("technician", "custom_person_in_charge_technician", function(doc, cdt, cdn) {
			var row = locals[cdt][cdn];
			return {
				filters: {
					designation: ‘Technician’
				}
			}
});