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
The script finds all application records where the owner is inactive and updates their owner to the corresponding manager, ensuring that ownership is correctly assigned to an active user.
This code snippet will update the owner of application records in the cmdb_ci_appl table where the current owner is inactive. It specifically sets the owner to the manager of that inactive owner, ensuring that each application has an active owner assigned.
2
+
3
+
**GlideRecord Initialization:**
4
+
var grApp = new GlideRecord("cmdb_ci_appl");
5
+
6
+
**Query for Inactive Owners:**
7
+
grApp.addEncodedQuery("owned_by.active=false");
8
+
9
+
**Executing the Query:**
10
+
grApp.query();
11
+
12
+
**Iterating Through Records:**
13
+
while(grApp.next()){
14
+
15
+
**Getting the Manager’s Sys ID:**
16
+
var managerSysId = grApp.owned_by.manager.toString();
0 commit comments