Can you access all of your instance user details from within an app. For example I want a dropdown of users within my Retool instance to use values within an app, tag employees to records, actions, notes, etc. However, they may have not logged into Retool yet.
You could use currentUser and insert into a locally controlled User table on page load but would be nice to tap into the Retool User object.
Hey @teamrappid — you can do this in the on-prem version of Retool in a roundabout way. When you deploy Retool on-prem, you control access to the database where users are stored. You can add this database as a resource in Retool and query it inside Retool apps to get the full list of users.
We don’t have great documentation on this, but if you want more information let me know and we can help!
Hi @Gabicus! Welcome to the community and thanks for posting.
The credentials to the database are stored as environment variables (e.g. in the docker.env file). You can grab those creds and then use them to add a Postgres database resource in Retool. Then you can query this database from Retool!
Hi @Gabicus, I wanted to add to Alex's response here. Please kindly note that this solution should be implemented with significant caution in production environments; having the backing database available as a resource may pose issues if not carefully managed (data being inadvertently updated or deleted, the database being over-utilized, etc.). As such, if you choose this solution, here are a few considerations/recommendations:
Add the database resource using a read-only database user credentials.
Ensure that your database has the necessary back-up and restore functionality.
Just a tiny note on this, it would be really nice to see a user lookup to get a username from a userid. At the moment I'm saving the current_user.firstName into my db but obviously would prefer to store the ID and run a lookup when displaying historic records from that user. I'm not an on-prem client.
Hey @TobiasOhlsson! Programatic access to organization metadata, including users, via the Retool API is currently a feature that is unique to the Enterprise level plan. I haven't heard about any plans to expand its scope, either.
That said - as @alex outlines above - it is possible to connect directly to the database where Retool stores this information if you are running an on-prem instance. This effectively gives you access to the same information.
For non-Enterprise cloud organizations, there unfortunately isn't a great solution. The one discussed above - storing currentUser information in a shared database - is probably the best I've come across.
If there are ever any updates, though, we'll be sure to let you know!