Ah, I see. Will definitely look into it if I get the chance
This code works on web form to filter the records and show in the drop down
frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Department",
filters: {
custom_type: "Department"
},
fields: ["name"],
limit_page_length: 1000
},
callback: function(response) {
let departments = response.message || [];
let formatted_options = departments.map(dept => ({
value: dept.name
}));
frappe.web_form.fields_dict.custom_department.set_data(formatted_options);
}
});