I am working on a service portal widget, and how do I get the user information in client script.

jieLian123
Tera Expert

I am trying to use g_user.hasRole 

but I got a ReferenceError: g_user is not defined.

so can't I use g_user in a client script of a widget?

In that case how do I got the Role of the current user role or some other  user information.

I am new to this, can anyone help me.

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

Hi @jieLian123 you can do that in server side and call it to client controller

Server side Code:

data.checkRole = gs.hasRole('itil');

 

client side

if(c.data.checkRole){

//your logic

}

Regards
Harish

View solution in original post

2 REPLIES 2

Harish KM
Kilo Patron
Kilo Patron

Hi @jieLian123 you can do that in server side and call it to client controller

Server side Code:

data.checkRole = gs.hasRole('itil');

 

client side

if(c.data.checkRole){

//your logic

}

Regards
Harish

thank you very much. it works.