- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2015 09:32 AM
Greetings All,
I have written a script to delete those users whose Email, User ID, Ldap-Server is blank. Please let me know if it is ok.
var encodedQuery="emailISEMPTY^user_nameISEMPTY^ldap_serverISEMPTY"; // semicolon added
var gr = new GlideRecord("sys_user"); //error here " needed to be closed
gr.addEncodedQuery(encodedQuery);
gr.deleteMultiple();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2015 10:29 AM
If you do go with deactivating, rather than deleting, I'd do it through the UI:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2015 03:09 AM
So did these manually added users create any records during that time? I mean did they access the system and work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2015 03:17 AM
I am not sure. might be Yes as SNOW came to us in Jan 2015 and got integrated with AD in april 2015

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2015 03:25 AM
Oh. Then if you delete the users and open any record that these users had created there will be not detail who created it.
I hope you understand. I suggest deactivate these users.
Please mark the response helpful or correct if you feel so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2015 03:37 AM
Ok surely i will consider your point but what if i use the following in my script:
autoSysFields(false); // Do not update sys_updated_by, sys_updated_on, sys_mod_count, sys_created_by, and sys_created_on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2015 07:21 AM
All that does is make sure you don't strap your name as the last updated by to the record you're deleting. Wouldn't matter what the sys_updated/created values were after a delete anyway.