Change a NetSuite Email Address and Password

The following sample shows how to change the currently logged-in user's NetSuite email address and password.

Note:

This sample script uses the require function so that you can copy it into the SuiteScript Debugger and test it. You must use the define function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.

Warning:

When you run this sample code in the SuiteScript Debugger, it logs a real request to change the email address and then changes the password.

Important:

The values used in this sample for the password and email fields are placeholders. Before using this sample, replace the password and email field values with valid values from your NetSuite account. If you run a script with an invalid value, an error may occur.

          /**
 * @NApiVersion 2.x
 */

// This script changes the currently logged-in user's NetSuite email address and password.
require(['N/auth'],function(auth) {
    function changeEmailAndPassword() {
        var password = 'myCurrentPassword';
        auth.changeEmail({
            password: password,
            newEmail: 'auth_test@newemail.com'
        });
        auth.changePassword({
            currentPassword: password,
            newPassword: 'myNewPa55Word'   
        });
    }
    changeEmailAndPassword();
}); 

        

General Notices