This guide explains how to automatically add users to groups based on their selection of a user custom field during signup or profile update.
Required user level: Administrator
Summary
- Create the necessary groups
- Set up a User Custom Field
- Create an automation to add users to groups
- Test the setup
Creating the groups
First, create the groups you want users to be automatically added to:
- Go to your site’s Admin area
- Navigate to Users > Groups
- Click “New Group” for each group you want to create
- Make sure to add a “Full Name” for each group, as the automation script uses this
The automation script uses a group’s Full Name, so ensure you add one for each group.
Setting up the User Custom Field
Next, create a User Custom Field that users will select from:
- Go to your site’s Admin area
- Navigate to Users > User Fields
- Click “New User Field”
- Set up the field with appropriate options
Here’s an example of how your User Custom Field might look:
Creating the automation
Now, set up the automation to add users to groups based on their User Custom Field selection:
- Go to your site’s Admin area
- Navigate to Customize > Automations
- Click “New Automation”
- Choose a trigger:
- “When a user first logs in” to add users to groups at signup
- “Recurring” to run on a schedule, allowing users to change groups over time
- Select “Add user to group through custom field” as the action
- Choose your User Custom Field from the dropdown menu
- Configure the automation settings
Here’s an example of how your automation setup might look:
The automation now includes a dropdown to select your existing User Custom Fields, making setup easier and less prone to errors.
Testing the setup
To ensure everything is working correctly:
- Sign up as a new user or update an existing user’s profile
- Select an option from the User Custom Field you created
- Complete the signup or profile update process
Here’s an example of how the User Custom Field might appear during signup:
After the automation runs, you should see the user added to the appropriate group:
FAQs
Q: Can this automation add users to primary groups?
A: By default, this automation adds users to secondary groups. To set a group as primary, go to the group’s Manage > Membership settings page and select “Automatically set as primary group”.
Q: How often does the automation run if I choose the “Recurring” trigger?
A: You can set the frequency when creating the automation. Choose a schedule that best fits your community’s needs.
Q: What happens if a user changes their user custom field selection?
A: If you’ve set up a recurring automation, it will update the user’s group membership based on their new selection during the next run.
Additional resources
Last edited by @hugh 2024-07-16T02:47:08Z
Last checked by @hugh 2024-07-16T02:47:13Z
Check document
Perform check on document: