Blog | NetSuite | Concentrus

Get User Preference by SuiteScript

Written by Steven Chao | Nov 14, 2024 5:00:00 PM

When developing for NetSuite, you may sometimes need to handle user preferences. For instance, if you have a custom sublist with a column labeled “Date,” you might want to display the date based on the viewing user’s preferences.

To retrieve the user’s preferences, you can use SuiteScript’s N/runtime module to get the current user instance:

let currentUser = runtime.getCurrentUser();

The user instance contains the information for current user. After you get the user instance, there is a method on the user instance called getPreference. The syntax is as follows:

// Additional code
...
var userObj = runtime.getCurrentUser();
var userPrefDateFormat = userObj.getPreference({ name: 'DATEFORMAT' });
// Can also be written as userObj.getPreference('DATEFORMAT')
log.debug('User preference for date format: ' + userPrefDateFormat);
...
// Additional code

For the keys to use in the name field, you can refer to the official documentation. This page lists all the NetSuite preference configuration options that support SuiteScript, such as date, time, and number formats.

Using this method allows your customizations to provide a better user experience.

 

 

 


About Us

Concentrus is a leading provider of innovative cloud-based enterprise resource planning (ERP) solutions, including NetSuite. Our team of NetSuite experts offers a range of services, including NetSuite price analysis, NetSuite training, and NetSuite integration services.  

Our goal is to help businesses of all sizes maximize their investment in NetSuite by providing expert NetSuite cost optimization and implementation strategies. With years of experience as a NetSuite partner, our NetSuite administrators and NetSuite consultants are well equipped to help businesses of all sizes with their NetSuite consulting needs.  

Whether you're looking for a NetSuite consultant to help with your NetSuite implementation or you need ongoing NetSuite support, Concentrus is here to help. 

 

Read About Our Implementation Methodology

 

Want more NetSuite Tips and Tricks? Check out our Short & 'Suite videos