budibase
budibase copied to clipboard
Custom user fields cannot be used in dataset query
Hosting
- Self
- Budibase Version: 1.2.9
Describe the bug Selection parameters on datasource query stay empty is you use a custom field from user table
To Reproduce Steps to reproduce the behavior:
I added a field "client_id" to the BB usertable. I would like to use this field as a selection parameter in the query of a dataset. (like "select all the projects of the client the logged in user works for", not from other clients!) I added a param to the query: client_id = {{ Current User.client_id }} When I run the query, the parameter stays empty, though the field Current User.client_id is set
If I change the param to client_id = {{ Current User.id }} it works as expected. The user.id value is inserted in the query.
From memory, I think this is currently by design. I don't believe you can access custom fields inside the users table, just the global ones (ID, email, names etc). I think custom fields are expected and I personally think that custom fields provide 99% of the functionality for being able to use current user bindings at all, so I'll see if I can bring more attention to this internally.
I also tried to get access to the custom user fields through the public API. This is also not possible, you only get the standard fields returned. So you can define custom user fields, fill them with data and only look at them in the "Manage users" section of the builder?
This issue has been automatically marked as stale because it has not had recent activity.
This issue has been automatically marked as stale because it has not had recent activity.