Dynamic Dashboard Variables in Grafana v11.1.0 Based on User Teams

Hello everyone,

I’m currently working with Grafana v11.1.0 and SQL Server and I have a dashboard that needs to display variables that vary based on the team of the connected user. I have three teams, each with its own set of users.

Is it possible to get the current user’s team?
I found this endpoint in the Grafana API: http://x.x.x.x:3000/api/users/18/teams. How can I use it?
If so, could anyone guide me on how to implement this functionality?
Any tips or examples would be greatly appreciated!

Thank you!

are you using sqlite as backend for your grafana or something else?

do you have the teams info also in your ms sql database?

Yes, with SQL Server

please share your table schema in ms sql that has the teams values

what is the data you want to use for the variables tied to these teams?

your design is a flawed as both team names and user names can easily be changed in grafana

The data I want to use for the variables related to these teams comes from our internal database, which contains the current information on the teams and their members. Additionally, the dashboard for the HR team and the IT team is identical, but I would like to implement conditional logic. If the logged-in user is part of the HR team, I want to display a variable ‘IT Users’ that lists the users in the IT team. However, if the logged-in user is part of the IT team, I want this ‘IT Users’ variable to disappear (or be disabled).

1 Like