Update Database Colletion on button click

Hi All,

I need a little bit of help with my action.

Here is the scenario:


— Group
— Selected User


I used the random picker that displays a random user that is part of the same group filtered by excluding the logged in user email. Upon clicking the button, the logged in user’s selected user updates by the user that is displayed in the random list.

My difficulty comes from updating the current user. I am trying to remove the group field from the current user so they wont appear on the random list anymore because they are already selected.

I tried custom actions like Update Current User Group - but I cant select “empty” or I also tried Delete Current User Group > but that deletes the whole group not just the record. Any advice would be appreciated. Thank you.

Just to give you a background, the function I am looking to build would be similar to a secret santa function.

Hi @Edward,

I see, removing the connection from a record sometimes isn’t possible (I think you can do that only in many-to-many connections)…
The workaround in your case might be using a “technical” group to which you assign the Current user upon the selection.

Best regards, Victor.

@Victor Thank you for your help. Unfortunately, I was not able to achieve that action. I changed the relationship to may to may but even then I don’t have the option to update that relationship. I also troed sending the current user to a blank screen to see if I can update the data there (as a workaround) but no luck. Not sure what is missing. I also created the technical group, but can not change the current user group at all

@Victor I think I got it.

So the relation is set to: 1 User can have 1 group but 1 group can have multiple users.

When I create the action I select: Update current User Group and it prompts me to add a link. I figured that the action needs me to add an empty screen and the current user is pushed from the previous screen. On the new empty screen under Actions, I now have the option to update the group.

I spoke too early. Update the group actually updates the group not the relation…

@Victor Seems like this is the workaround.

I added a boolean to the users and set to False by default. If the user is added to the group the boolean gets set to true. The random picker filtered by users that has the boolean set to true. Upon adding the user to selected user field, the action also sets the current user boolean to false. Thats the workaround I found, however I welcome any other ideas that might be better :slight_smile:

Hi @Edward,

By using “Technical” group I meant the following:

  • create group called “SelectionPassed”
  • you can keep 1:many relation (user can belong only to 1 group)
  • when you’re updating the current user (and may be logged in user as well?) after the selection is made, you update group relation to “SelectionPassed”.
  • you might additionally need to filter out “SelectionPassed” group in the lists, but that depends on the app setup.

The solution with boolean property is good. You need to be sure though that this property is maintained correctly throughout the app.

Reg. “technical” group - it increases complexity, but also could be used. There is an option of record re-creation in similar cases (create new one with settings from old one except relation, then delete the old one), but this option isn’t suitable for users collection :grin:


I am sorry but I’m stuck on the resolution you provided.

Here is a simple example that I tested:

—Team Group (1 user can have 1 group but group can have many users)

Team Group
— Users

There are 2 groups. Group 1 and Group 2

I create a simple button > Actions > Update logged in user
I can not see a way to replace Group1 with Group 2.

Not sure what I am doing wrong

Attached the image about the options I have

need help

Hi @Edward,

Sorry, I forgot about one important thing here. Making a video, will post shortly. My apologies

1 Like

Hi @Edward

Here is how I do it via single-item list. The idea is to get access to “Groups” by making a list of groups from a button, filtered by desired group name. This may help.
Though may be the boolean approach is better and easier in your case.

1 Like

Awesome thank you so much. This will help me in a lot of things!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.