If you want to create a ‘username’ for your user datatype during signup but you want to limit the number of fields the user has to fill in to limit friction for signup, you could follow this approach.
Instead of having a data field of ‘username’ rely on the use of the built in slug filed on the user data type to store this information.
Then on signup you obviously need the users email address and that can be utilized to create a unique username by harnessing the slug feature functionality.
In your workflow for signup add a step to ‘set a things slug’ and in that you can have a dynamic expression that would reference either the users email address or the input value used to capture their email address. In that expression you’ll want to use an extract with regex pattern
This will result in the users email address being stripped of the email clients domain name as well as the @ symbol…so it would only be the email ‘handle’.
The slug feature will ensure that any other users who have the same email handle doesn’t cause a problem, since Bubble handles the uniqueness of a slug by appending a numerical value for duplicates.
Later you can have in the users profile section an ability for them to manually change that ‘username’.