Use N/runtime Module in Netsuite for User Details

Netsuite N/runtime module provides methods to get the user inside the script, these are very useful if you want to set the current logged-in user into any field on record or if you want to use the email id of the current user, etc.

** Please Note: If the user event script or suitelet script is triggered because of Scheduled Script or scheduled Map Reduce Script, it will not return any user id instead return the system as the script is triggered by the system not by the user.

var userObject = runtime.getCurrentUser();

To get User Contact:

 var contact = userObject.contact ;

To get User Department :

 var department = userObject.department ;

To get User Email:

var userEmail = userObject.email ;

To get User Id:

 var userId = userObject.id;

To get User Location:

 var userLocation = userObject.location;

To get User Name:

var userName = userObject.name;

To get  User Role:

 var userRole = userObject.role;

To get  User Subsidiary:

var userSubs = userObject.subsidiary

Leave a comment

Your email address will not be published. Required fields are marked *