module (N/runtime)

SuiteScript 2.0


{User}.getPreference({name: {string*}})

N/runtime Module
Method Description: Returns the value set for a NetSuite preference. Currently only General Preferences and Accounting Preferences are exposed in SuiteScript. You can also view General Preferences by going to Setup > Company > Preferences > General Preferences. View Accounting Preferences by going to Setup > Accounting > Preferences > Accounting Preferences. If you want to change the value of a General or Accounting preference using SuiteScript 2.0, you must load each preference page using config.load(options), where is COMPANY_PREFERENCES or ACCOUNTING_PREFERENCES. The config.load(options) method returns a record.Record. You can use the Record.setValue(options) method to set the preference. For more information about these preferences, see General Preferences and Accounting Preferences. The permission level will be Permission.FULL if the script is configured to execute as admin. You can configure a script to execute as admin by selecting “administrator” from the Execute as Role field on Script Deployment page.
Returns: string
Supported Script Types: Client and server scripts For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/runtime Module
Since: 2015.2
Search NetSuite -


// Code Example 1
// Add additional code
var userObj = runtime.getCurrentUser();
var userPref = userObj.getPreference ({
name: 'emailemployeeonapproval'
log.debug('User preference for emailemployeeonapproval: ' + userPref);
// Add additional code