g_user.getUserID() alternate options in Service Portal

Community Alums
Not applicable

Hi All,

I want to get the logged in user in my client script which I will be running on a catalog item.

This script should support both Service Portal view and Application view

When using g_user.getUserID in client script, it works fine in Application view but in Service Portal it gives me an error -  TypeError: g_user.getUserID is not a function.

Is there an alternate solution for this? Since I am using client script, gs.getUserID() is not accepted.

Thanks and Regards,

Vishnu

1 ACCEPTED SOLUTION

Mark Stanger
Giga Sage

There should be no problem with this, but I believe you want 'g_user.userID'.

Please mark this response correct if I've answered your question.  Thanks!

View solution in original post

5 REPLIES 5

Kanishak
Tera Contributor

Hi,

I have tried this 'g_user.userID' but it is giving error , so can anyone help that how it works fine.