How to get current logged in user and department and email in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 09:57 PM
How to get current logged in user and department and email in ServiceNow
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2024 03:18 AM
// Get current logged-in user
var currentUser = gs.getUser();
// Get the user's display name
var displayName = currentUser.getDisplayName();
// Get the user's email address
var email = currentUser.getEmail();
// Get the user's user ID
var userID = currentUser.getID();
// Print the information to the system log
gs.info("Logged-in user: " + displayName);
gs.info("Email address: " + email);
gs.info("User ID: " + userID);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2025 12:46 AM
Hi Srinivas and All,
In case anyone wondering how to get Phone number of logged In User:
gs.getUser().getRecord().getValue('mobile_phone');
Regards,
Ankit