How to notify an admin when a new user signs into NetSuite
In this guide, we’ll walk through how to automate an email notification whenever a new user logs into NetSuite. This can help administrators take necessary action promptly or investigate unexpected logins.
What we’ll do
Create a saved search on the Employee record.
Create a scheduled script.
Create saved search
Open your NetSuite, Go to Lists > Saved Search > New
In the next screen, Select Employee as the record type.
Now, Enter a Name and ID, and also set it to Public as shown below.
Important Note📝: Write down the ID of the saved search once it is saved. We will use it later in the scripting stage.
It’s time to add the criteria now. Add the following Criteria in your Saved Search:
Date Created -> Within This Year to Date (adjust as needed).
Pro Tip: Remove access of employees from your NetSuite account who have been given access but never logged in. NetSuite isn’t cheap, and full-license users are limited. We will cover this automation in another topic.
Login Audit Trail: Date -> is not empty (join on Login Audit Trail fields)
Login Audit Trail: Status -> is Success
Now, let’s add what we want to show in the search results. Add the following Results:
Login Audit Trail: Date, Summary Type: Minimum, Summary Label(optional): First Login
Name, Summary Type: Group
Save & Run
Explanation: We created a saved search which gets all successful login attempts by employees created within a certain period. We get the minimum date of login because that tells us the first time they logged in.
Lets create this Scheduled Script now
You might be wondering why we need this script. The purpose of this script is to run on a scheduled basis, pull data from the saved search we created earlier, and notify the account administrator whenever someone logs into NetSuite.
Let’s create it together step by step.
First, you’ll need the code. Download the first_login_notification.js file from this repo.
Open the file in any text editor(notepad is also fine) and update the saved search ID on line number 18 (this is the one you noted earlier when creating the saved search).
const mySearch = search.load({ id: ‘customsearch4513’ });
Now go back to NetSuite, click on Customization > Scripting > Scripts > New.
Click the plus (+) icon next to the Script File field.
Enter a name and upload the script file you downloaded and edited.
Click Create Script Record, it should take you to the next screen where we will enter all the script details.
Enter Name, ID and Click Save.
Great work, you’ve just created a scheduled script in NetSuite!
The next step is to deploy it. But before deployment, we need to add a script level parameter that allows you to specify the administrator who will receive the email notification whenever someone logs in.
How to create a script level parameter
Go to the Parameters tab of the script.
Click New Parameter.
Enter a Label, enter the ID exactly as shown below. Set Type to List/Record. In List/Record, select Employee. Click Save.
Now we’ve reached the final step: deploying and scheduling the script. If you’ve made it this far, you’re doing an excellent job!
How to deploy a script in Netsuite
On the script record page, click Deploy Script.
Enter a TITLE and ID. Set Status to Scheduled and Log Level to Debug/Audit.
In the Schedule tab: Check Daily Event and Set Repeat to Every 15 Minutes (as shown below in the screenshot).
In the Parameters tab, select the user who should receive the new login notification email.
Click Save.
Woohoo! 🎉 Your admin will now receive the email below every time a new user logs in.














