Trying to get a list of which employees had netsui...
# suiteql
c
Trying to get a list of which employees had netsuite access, along with the date ranges and type of access (full user vs employee center) — any tips to accomplish that?
j
Here’s a search I use. Note that I’m filtering on a particular date, but you can tweak this for your needs.
Copy code
SELECT employee.firstname AS firstname, 
employee.lastname AS lastname, 
employee.id AS employee_id,
role.name AS role_name,
employee.email AS email,
role.id AS role_id

FROM employeeroles
JOIN employee ON employee.id = employeeroles.entity
JOIN role ON role.id = employeeroles.selectedrole

WHERE employee.isinactive = 'F'
AND (employee.releasedate IS NULL OR employee.releasedate > '1-Jan-2023')
AND employee.giveaccess = 'T'

ORDER BY employee.lastname, employee.firstname, role.name
Then I do this:
Copy code
SELECT loginaudit.user AS employee_id,
loginaudit.role AS role_id, 
MAX(TO_CHAR(date, 'YYYY-MM-DD HH24:MI:SS')) AS last_login
FROM loginaudit
WHERE status = 'Success' 
AND detail NOT IN ('RoleSwitchLogout', 'ExplicitLogout')
GROUP BY loginaudit.user, loginaudit.role
🙌 1
and do some joiny goodness in SS
w
Here's a complete query that gives you all employees (that still exist in the system) that had login access on the given date.
🙌 2