The CreatorCon Call for Content is officially open! Get started here.

How to get current logged in user in server side and client side?

ak4
Tera Contributor

How to get current logged in user in server side and client side?

 

5 REPLIES 5

Kunal Varkhede
Tera Guru

sriram35
Kilo Guru

Hi,

 

Client-Side:

 

g_user.userID

 

 

Server-side:

 

gs.getUserID();

 

 

 

Hope this helps!

If I have answered your question, please mark my response as correct and/or helpful.

Thanks,

Sriram

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

please find below lines

client script: g_user.userID

Server side: gs.getUserID()

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar  How do I get a current logged in user's Primary Group?

I have tried a below script but it is not working

var priGrp = gs.getUserID().getRecord().getDisplayValue('primary_group');

Primary Group is Reference field.