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.
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.
@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
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…
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
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
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.