AltorraUser (A More Useful User Object)
- Altorra Solutions

- Jul 23
- 2 min read
Overview
Elevate your ServiceNow scripting with the AltorraUser Class! This innovative class extends the capabilities of the standard GlideUser API by returning a fully functional GlideRecord object for any user—whether the currently logged-in user or a specified one via sys_id or user_name. Unlike the undocumented getRecord() method, which limits dot-walking and may return cached data, this class provides fresh, query-able data and enables seamless dot-walking for deeper insights. Ideal for developers and admins, it simplifies user data retrieval while enhancing flexibility and accuracy in your scripts.
How It Works
The AltorraUser Class is easy to instantiate and use in your Server-side scripts. Here's a step-by-step guide:
Instantiate the Class: Create a new instance of the class in your script.
For the current logged-in user: var userGR = new AltorraUser();.
For a specific user: Pass the sys_id or user_name as a parameter.
Access the GlideRecord: The class returns a GlideRecord object queried from the sys_user table.
Use standard GlideRecord methods like getValue('field_name'), getDisplayValue('field_name'), or dot-walking
Handle Edge Cases: If the specified user record is not found, the class returns a blank/empty GlideRecord object to prevent errors.
Retrieve Data: Query fields such as name, email, title, or dot-walk to related records like manager or department for comprehensive details.
Key Features
Full GlideRecord Functionality: Returns a true GlideRecord, enabling queries, updates, and dot-walking (e.g., accessing manager's details seamlessly).
Flexible User Selection: Defaults to the current user if no parameter is provided; accepts sys_id or user_name for targeted retrieval.
Fresh Data Retrieval: Bypasses cached information from the last login, ensuring the most up-to-date user record.
Error Handling: Gracefully returns an empty GlideRecord if the user isn't found, avoiding script failures.
Benefits
Enhanced Accessibility: Overcomes limitations of the undocumented GlideUser.getRecord() method, making advanced user data easier to work with.
Dot-Walking Support: Unlike getRecord(), you can traverse relationships without undefined results.
Productivity Boost: Reduces scripting complexity for tasks involving user info, perfect for custom workflows, notifications, or reports.
Reliability: Always pulls current data, ideal for dynamic environments where user details change frequently.
Tips
Use in Server-side contexts only, as GlideRecord is not available Client-side.
Test with invalid sys_ids to confirm the empty GlideRecord fallback works as expected.
Combine with other PowerClick tools for even more streamlined user management in ServiceNow.
Remember, this class queries the sys_user table—ensure proper permissions to avoid access issues.
With the AltorraUser Class, unlock deeper user insights effortlessly. Work Better - Not Harder!
If you still have any questions, comments, or need any support, please reach out to us, by visiting https://www.altorra.com/support
Be sure to also explore the other powerful tools in the PowerClick Toolkit Essentials, along with our other exceptional products, designed to streamline your daily tasks, boost efficiency, and save you valuable time.



Comments