For every # of user create something

I have a community website and I want to basically create groups for users that are joining. To break it down further, each group would contain only five users, when the first user joins, a new group is created. Once the sixth user joins a new group is created until the 11th user joins then a new group is created. I want the flow to continue in this manner when a new user joins, how can I do this in Bubble?

Idea:
For 5 new users ā†’ create a new group ā†’ assign workflow one to workflow two

Hopefully it makes sense

I think we can implement this very quickly using a Database trigger backend workflow.
On the Group data type, Iā€™d maintain a member_count field.
The database trigger will be triggered when a new user is created, and will do something along those lines:

  • Upon creation, search for a Group that has less than 5 members (member_count < 5). If this group exists, add the new user in the Group.
  • If there is no such group, create a new Group, then add the user in the new Group.
  • Either cases, increment member_count by one for that group
1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.