Get the information of user roles

Hi Chui Chi
When you say you assign [1] are you saying that you try to read roles[1] or write to roles[1]?

A simple test for you will be to extend Lior’s proposed script like so:

import wixUsers from 'wix-users';
  $w.onReady(function () {
       wixUsers.currentUser.getRoles()
        .then((roles) => {
             console.log('Received '+roles.length+' roles');
             for (let i = 0 ; i < roles.length ; i++) {
                  console.log(roles[i]); //output will be: {name: "Student", description: "Student site member"}
             }
        })
  });

wix-users api is one way (read only). You must manage roles in the Wix CRM dashboard before you can access the roles in code.

Hope this helps
Steve