Are all watch list assignments stored in a single table?

perkinsarm
Mega Guru

We are a new ServiceNow customer. We imported records from another system and brought in many users that were on that system's equivalent of the ServiceNow's Watch List. Some of those users are retired or no longer with our organization but associated with many records. We would like to clean these up, but don't wan't to have to manually remove them from each record.

Are are watch list assignments stored in a dedicated table (or tables) where we could make user deletions?

Thanks,


Brad

4 REPLIES 4

Michael Fry1
Kilo Patron

The watch list is basically a reference to the User table, but presented in a List format. If you delete the users from the User table, I believe it will leave the sys_id in the watch list. It won't hurt anything, just look strange. However, that makes me say, why deleted them versus just leaving them inactive?


Community Alums
Not applicable

Watchlist is a list field type stored on the 'task' table; most functioning modules such as Incident, Change, problem, extend the task table, thus share a lot of the same fields.



You could query the Incident table (or whichever records you're referring to), and get the list of users (by sys_id) from within the watchlist. They're stored as comma separated values, so you'd have to loop through the records, match the userid with the sys_id, and remove the sys_id from the list.


Michael Fry1
Kilo Patron

After I clicked send I realized you might be able to create a background script and remove those inactive users, then delete them.


Community Alums
Not applicable

This is what I was thinking:



var gr = new GlideRecord('incident');


gr.addQuery('number', 'INC0040519');


gr.query();


while (gr.next()) {


gs.print(gr.number + " | " + gr.watch_list);


}



Returns:



Script: INC0040519 | c1cf27aa2b08210094fa36bc27da1594,69a36cdf2bd0610094fa36bc27da1554,627a9a636f1c210087f8d4e44b3ee487



You could 'split' the list, write a for loop to iterate/match the sys_ids, delete the entries and update the record.



Cheers,



Tim