User.getPreference(options)
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 > General Preferences. View Accounting Preferences by going to Setup > Accounting > Accounting Preferences. If you want to change the value of a General or Accounting preference using SuiteScript 2.x, you must load each preference page using config.load(options), where For more information about these preferences, see General Preferences and Accounting Preferences.
Note:
The permission level will be Permission.FULL if the script is configured to execute as administrator. You can configure a script to execute as admininistrator 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.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
Internal ID of the preference. For a list of preference IDs, see Preference Names and IDs. |
2015.2 |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/runtime Module Script Samples.
// Add additional code
...
var userObj = runtime.getCurrentUser();
var userPref = userObj.getPreference ({
name: 'emailemployeeonapproval'
});
log.debug('User preference for emailemployeeonapproval: ' + userPref);
...
// Add additional code