I need to remove a user from several Incident watchlists as they are moving teams.

mark_oldroyd
Tera Contributor

It's too many to ideally do this manually, could someone point in the right direction scripting wise for removing users from lists while maintaining the other members of the list.

1 ACCEPTED SOLUTION

jarodm
Mega Guru

This can definitely be scripted. The watch list is just a comma-separated list with sys_ids and email addresses.



If I were to script this, my first attempt would be to:


  • Get the sys_id of the user
  • Query table for all records where watch_list contains the sys_id of the user
  • For each record
    • Convert the watch list to an array
    • Remove the sys_id
    • Convert array back to string
    • Set watch list to new string
    • Update record
  • Sprinkle in lots of debugging messages along the way


This could probably be optimized, but since it's rarely going to run as a fix-script (my preference) or background script, This can probably be done later.



Please post a status update on how well this turns out.


View solution in original post

3 REPLIES 3

jarodm
Mega Guru

This can definitely be scripted. The watch list is just a comma-separated list with sys_ids and email addresses.



If I were to script this, my first attempt would be to:


  • Get the sys_id of the user
  • Query table for all records where watch_list contains the sys_id of the user
  • For each record
    • Convert the watch list to an array
    • Remove the sys_id
    • Convert array back to string
    • Set watch list to new string
    • Update record
  • Sprinkle in lots of debugging messages along the way


This could probably be optimized, but since it's rarely going to run as a fix-script (my preference) or background script, This can probably be done later.



Please post a status update on how well this turns out.


Thanks Jarod I will give this a whirl next week and let you know how it goes.


Munender Singh
Mega Sage

Hi Mark,



Please refer to this thread,Managing Glide Lists



Regards,


Munender