Just to clarify a little here…
The only real reason to use User Profile Roles is if you want to use the named roles as Row Owners - either in the same table or other tables. This is a way to restrict which rows of data will be available on each users device, and it allows you to group users together so that they have access to the same set of data rows. For example, consider a business hierarchy where a CEO should have access to all users data, and functional managers should have access to the data of only their direct reports. Roles as Row Owners is a good way to secure data in this scenario. Have a read of the below for a more detailed explanation:
When using User Profile Roles, there are general rules about when a role can be set:
- when a user is created, the role can only be set if the creator has the same role as the one they are attempting to set
- when a user record is being edited, the role value cannot be changed under any circumstances.
- in both of the above cases, you might see the change made initially, but as soon as the builder syncs with the Glide back end the change will be reverted (which explains your experience).
There are two workarounds to each of the above:
- manually edit/set the role via the data editor
- use the Glide API
However, if your goal is to just to use “roles” to control tab/screen/component visibility, then it is not necessary to use User Profile Roles. Instead you can use what I like to refer to as pseudo roles. In this scenario you can have a Role column in your User Profiles table, but you don’t set it as such in your User Profiles Configuration. When using pseudo roles, there are no restrictions on setting/changing values. As long as the user making the change has access to the row, they can set the value.