Removing users from a watchlist

Thomas Michels1
Kilo Contributor

Hi people

I'm looking for a way to remove a user from a field list when they are deactiveted. I've been looking at the flow designer to do this, but I can't seem to get a grip on it. Has anyone been in this or simular situation before?

 

BR - Thomas

1 ACCEPTED SOLUTION

Andrew Barnes -
ServiceNow Employee
ServiceNow Employee

Greetings Thomas,

 In order to do this, you need to search for records that meet your criteria, like active=true and disableduser is in watch list. Then when you have your records, you cut that users sys_id out of the list. This can be done with a business rule or flow. You will need to script the whole thing for a business rule, and will have to script the removal of the sys_id in a custom action in flow designer. 

-Andrew Barnes
Join me at Developer Blog

View solution in original post

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Question, is this about all or multiple watchlist (list type) fields in general? Or one specific on for example Incident form?

You could simply go for a Business Rule, which runs on after / async of update on sys_user. Simply querying the table you are after, and if the wachtlist fields contains the users sys_id. If so, a while to update the watchlist (for example stripping the sys_id).
Do consider that those records will receive an update. Is this wanted yes / no? Maybe add .setWorkflow(false). Test carefully, what impact / how many records would this concern? Etc..

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Andrew Barnes -
ServiceNow Employee
ServiceNow Employee

Greetings Thomas,

 In order to do this, you need to search for records that meet your criteria, like active=true and disableduser is in watch list. Then when you have your records, you cut that users sys_id out of the list. This can be done with a business rule or flow. You will need to script the whole thing for a business rule, and will have to script the removal of the sys_id in a custom action in flow designer. 

-Andrew Barnes
Join me at Developer Blog

Hi Andrew

 

Yeah, I had an idea that I had to do some scripting. 

Thanks! 🙂

 

BR - Thomas

Hi @Andrew Barnes - @Mark Roethof 

 

I could able to remove the Watchlist users on current Incidents like you mentioned using a script ( criteria is Active is true and disabled user in watchlist) .

 

How to apply this on newly created New incidents ? I mean --newly created incidents also should not take that particular user as watchlist ? how to add this logic ?

 

Can you help me with this ?