User Object Members in SuiteScript 2.x Runtime Module
User Object Members provide access to user details and preferences in the SuiteScript 2.x N/runtime module, crucial for customized scripting.
TL;DR Opening
The User Object Members in the SuiteScript 2.x N/runtime module enable developers to access the properties and preferences of the user executing the script. Understanding this functionality is essential for creating tailored and efficient script workflows.
What is the N/runtime Module?
The N/runtime module is a core component in NetSuite's SuiteScript 2.x framework that allows developers to interact with runtime settings for scripts, user sessions, and account features. It provides methods to:
- Get runtime information about the script and user session.
- Access user properties like email, department, and permissions.
User Object Members Overview
The User Object Members allow for manipulation and retrieval of user-specific information while executing scripts. Here’s a breakdown of its key methods and properties:
User Methods
| Method Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
| User.getPermission(options) | string | Client and server scripts | Returns the user permission level for a specified permission. |
| User.getPreference(options) | string | Client and server scripts | Retrieves the value of a specific NetSuite user preference. |
User Properties
| Property Name | Type | Description |
|---|---|---|
| User.contact | number (read-only) | The internal ID of the logged-in contact. |
| User.department | number (read-only) | The internal ID of the user's department. |
| User.email | string (read-only) | The email address of the current user. |
| User.id | number (read-only) | The internal ID of the current user. |
| User.location | number (read-only) | The internal ID of the user’s location. |
| User.name | string (read-only) | The name of the current user. |
| User.role | number (read-only) | The internal ID of the user's role. |
| User.roleCenter | string (read-only) | The role center string for the current user. |
| User.roleId | string (read-only) | The custom scriptId of the user's role. |
| User.subsidiary | number (read-only) | The internal ID of the user’s subsidiary. |
Practical Usage
These methods are vital when you want to personalize the user experience based on specific parameters set for each user account, such as fetching user preferences or verifying roles to manage access more effectively in custom scripts.
Who This Affects
- Developers: Understanding User Object Members enhances scripting within SuiteScript 2.x.
- Administrators: They can manage user customization and access based on preferences retrieved through these objects.
Key Takeaways
- The N/runtime module offers essential tools for obtaining user-specific information.
- User Object Members include methods for accessing permissions and preferences.
- Effective usage of these members can significantly enhance the script's functionality and user interaction.
Frequently Asked Questions (4)
How can I retrieve the email address of the current user in SuiteScript 2.x?
Which script types are supported for the User.getPermission method in SuiteScript 2.x?
Can I modify user properties like the department or location using SuiteScript 2.x User Object Members?
What kind of information can be accessed using the N/runtime User Object Members?
Was this article helpful?
More in SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category