getUserID()

The gs.getUserID method is used to determine the sys_id of the currently logged-in user.

sys_id is the unique identifier column available in all ServiceNow tables, including any custom table created by an admin, and also the sys_user table, which stores user records.

Usage:

gs.getUserID(); //return the sys_id of the currently logged in user 

Example:

gs.log( "The current logged in user ID is "+ gs.getUserID() ); 

Get ServiceNow Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.