How to assign a unique username to users in your Bubble.io app

Himanshu Sharma
3 min readAug 4, 2020
Unique username in Bubble.io web app — Nocodeassistant

A lot of times, you’d run into a situation where you need a unique value for each user. It can be a username, slug or anything else. The method to check that a value is unique can be extended to a variety of situations.

To explain how you can let a user set a unique username for them, I’ve created the structure here.

Editor- https://bubble.io/page?type=page&name=slug&id=nocodeassistant-tutorials&tab=tabs-1

Preview- https://nocodeassistant-tutorials.bubbleapps.io/version-test/slug

Workflow structure

I’ve placed a repeating group to search and display the user’s details. And on the right, I’ve set up an input to type a new username. Upon selecting a user on the left, his/her details will be displayed in the User Info group on the right.

When we click on button Set, I set up 2 workflows to check the validity of the new username. The username/slug details are stored in User data type for each user.

Username is unique and valid

To check if the username is unique, I do a Search for Users with constraint as Slug=Input’s value. If the count is 0, it means that the username is unique and I display a username changed message.

Username is not unique and valid

If the count > 0, it means that the username/slug is taken by another user and it is not valid.

I then display an error message to the user to try a new username.

The basic principle of searching a unique value can applied to a lot more cases. I hope you’ve understood the working and will be able to tailor it according to your own needs.

Editor- https://bubble.io/page?type=page&name=slug&id=nocodeassistant-tutorials&tab=tabs-1

Preview- https://nocodeassistant-tutorials.bubbleapps.io/version-test/slug

If you need some help with your Bubble app, hit me up at himanshu@nocodeassistant.com or follow me on Twitter

Originally published at https://nocodeassistant.com on August 4, 2020.

--

--