I have a doctype with Link field with option as “User”. But I don’t want ti show all users in link field. i.e. want to filter this link field, say having email id in [“aaa@gmail.com”,"bbb@gmail.com", …].
how can I achieve this?
I have tried following code:
frm.set_query(“user”, function() {
return {
filters: [
[“User”,“full_name”, “in”, [“bbb@gmail.com”, “aaa@gmail.com”, “ccc@gmail.com”]]
]
}
});
But getting following error:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 941, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/search.py", line 14, in search_link
search_widget(doctype, txt, query, searchfield=searchfield, page_length=page_length, filters=filters)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/search.py", line 39, in search_widget
searchfield, start, page_length, filters)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/search.py", line 35, in search_widget
searchfield, start, page_length, filters, as_dict=as_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 941, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py", line 820, in user_query
if filters and filters.get('ignore_user_type'):
AttributeError: 'list' object has no attribute 'get'
How can I bring selected link field values on the form?