You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var user = new GlideRecord("sys_user"); // Glide to user table
2
-
user.addActiveQuery();
3
-
user.addEncodedQuery("u_service_account=true"); // Adding encoded query to filter the only Service Account
1
+
var user = new GlideRecord("sys_user");
2
+
user.addActiveQuery();
3
+
user.addEncodedQuery("last_login!=NULL");
4
4
user.query();
5
5
while (user.next()) {
6
-
var arr = []; // Definind an empty array
7
-
arr.push(user.user_name); // pushing all he usernames with in the array
6
+
var arr = [];
7
+
arr.push(user.last_login);
8
8
for (var i = 0; i <= arr.length - 1; i++) {
9
-
var userID = arr[i];
10
-
var query1 = "sys_created_onRELATIVELT@dayofweek@ahead@40^sys_created_by=" + userID; // creating a dynamic query to check if the account has any transaction in last 40 days on transaction table.
11
-
var tranSaction = new GlideRecord("syslog_transaction"); // Glide to the tranaction table
12
-
tranSaction.addEncodedQuery(query1); // adding an query1
13
-
tranSaction.query();
14
-
tranSaction.orderByDesc("sys_created_on");
15
-
if (!tranSaction.next()) {
16
-
gs.print(arr); // this will print only user names which does not have any transaction in last 40 days on log transaction table.
9
+
var time = arr[i];
10
+
var date1 = new GlideDate();
11
+
date1.setValue(time);
12
+
var date2 = new GlideDate();
13
+
var millisecondsDifference = date2.getNumericValue() - date1.getNumericValue();
0 commit comments