budibase icon indicating copy to clipboard operation
budibase copied to clipboard

Custom user fields cannot be used in dataset query

Open evtnl opened this issue 3 years ago • 3 comments

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.

evtnl avatar Aug 19 '22 14:08 evtnl

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.

aptkingston avatar Aug 19 '22 14:08 aptkingston

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?

evtnl avatar Sep 01 '22 12:09 evtnl

This issue has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Nov 01 '22 12:11 stale[bot]

This comes up more often: 8824, 3214

evtnl avatar Dec 09 '22 07:12 evtnl

This issue has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Mar 25 '23 03:03 stale[bot]