How to use get_query to get User containing a role?

How to use get_query to get User containing a role?
How do I make a report to screen Users for a role?
Thanks.

Please help me.

For retrieving the role, see the accepted answer :

Can you elaborate your use case here ?

I added a filter to report to find users with a role.
For example,

{
	"fieldname": "customer",
	"label": __("Customer"),
	"fieldtype": "Link",
	"options": "User",
	"default":"",
	"get_query": function () {
		return {
			filters: [
				["UserRole", "role", "=", "Customer"]
			]
		}
	}
},

This one I wrote was unsuccessful. I donā€™t know how to filter Link through Role.

Can someone help me? Thank you.

@Wjp43045 Can you explain me brieflyā€¦?

Try:
frappe.get_roles(frappe.session.user)

2 Likes

I added a filter to report to find users with a role.
For example,

{
	"fieldname": "customer",
	"label": __("Customer"),
	"fieldtype": "Link",
	"options": "User",
	"default":"",
	"get_query": function () {
		return {
			filters: [
				["UserRole", "role", "=", "Customer"]
			]
		}
	}
},

Sorry, Iā€™m not trying to get the role of the logged-in user, but to use filter to filter all Users with a role in the report