// Check if doc.purpose has a value
if (frm.doc.purpose) {
// Get the current user’s location from the user’s doctype
const currentUser = frappe.session.user;
frappe.db.get_list(‘User’, {
filters: {
name: currentUser
},
fields: [‘location’],
limit: 1
}).then((results) => {
if (results && results.length > 0) {
const currentUserLocation = results[0].location;
// Filter assets by location
filters.location = currentUserLocation;
}
});
}
return { filters };
})
This code is showing filter = user’s location,
but not filtering actually
Anyone here who can help me?
Thanks
Shubham