How to add a new item to a list that is a variable of User?

Hi,

I have an Installation datatype that has api keys and a name variables. I want each user to have a list of Installations they ‘own’. How to add a new Installation and assign it to a user?

I wanted to achieve an effect where the settings page displays all Installations for a current user, which I achieved. However, I wanted to add a button(icon on screen) that allows you to add a new Installation. It can even be empty and the user will be able to edit their details later. However, I don’t know how to create workflow to add new values to the list of Installations for the user.

Front:

Data:



Thanks,
Piotr

Hi there, @fastshop.office… if you are trying to have a list of installations on the user, then in the workflow where an installation is created, add another action to make changes to the current user, and the change to make is to add the result of the step that created the installation to the user’s list of installations. That being said, do you really need the list of installations on the user given that the built-in Created by field on the Installation data type enables you to easily get all of the installations that were created by the current user?

Best…
Mike

Hi @mikeloc,
Thanks a lot for so fast response. Yeah, that’s what i meant, worked perfectly.
About your suggestion: from the point of view of optimization i think that is faster to get current user’s list of Installations than to get every single element and check if created by is matching current user. But i may be wrong. Let me know what you think :slight_smile:

Thanks a lot,
Piotr

1 Like

Searches are pretty darn fast, but if a user is going to have a relatively small list of installations (single digit or low tens, but definitely under a hundred), then there is nothing wrong with having that list.

Okay, thanks for advice anyway. That’s my first project in Bubble, so it’s nice to get some.

Yeah, definitely len of list is single digit.

1 Like