Flow designer for adding group members in Incident watch list

Mohammed Daiyan
Tera Contributor

Hello all,
I have a check box field in INC form, once it is checked then all the members from a specific group should be added to the watch list, of that incident, this needs to be done through a FLow designer.
Please help me out, I have tried in PDI but I could get only a single group member added in the watch list and not all members.

MohammedDaiyan_0-1725963664648.png

 

10 REPLIES 10

Mohammed Daiyan
Tera Contributor

Please find the screenshots of the flow I have created and the testing part, I have added 4 members in a group and the flow is adding only 1 member of the group out of 4 members.

1.

MohammedDaiyan_0-1725980422957.png

2.

MohammedDaiyan_1-1725980431846.png

3. 

MohammedDaiyan_2-1725980443612.png

4.

MohammedDaiyan_3-1725980476853.png

5.

MohammedDaiyan_4-1725980487341.png

6

MohammedDaiyan_5-1725980494399.png

 

@Mohammed Daiyan You need to slightly tweak your flow here, as a first step create a flow variable of type array or string, You will update the value of this flow variable using Lookup records and add user sys_ids to it with each iteration (array.push('sys_id') or str=str+user.sys_id+',') after Lookup records action you can use the Update record action to update the watchlist of the incident with this flow variable. 

 

Essentially the flow variable will be a comma separated list of user sys_ids. In your current implementation the watchlist variable is getting overwritten by each iteration due to which it only contains single user from the last iteration.

 

Hope this helps.

johnmmiller
Tera Expert

It sounds like you have the right idea, but are replacing the Watch List with the sys_id every iteration of the loop you are using.

 

This can be solved with a little bit of scripting.

SN Community.png

Code:

 

return  (fd_data.flow_var.user) ? 
        (fd_data.flow_var.user + ',' + fd_data._2__for_each.item.sys_id) : 
        (fd_data._2__for_each.item.sys_id);

 

Using a ternary operator instead of a if/else block.

 

You should use a Flow Variable so that you don't need to update the Incident for every iteration of the loop.

 

Note: You can also use the same concept to 'add' users to the Watch List instead of 'replace' the entire Watch List.

Hi John,
Thanks for replying, I tried adding the flow variable and adding the script to it, but could not get all the group members added to the watchlist.

Please check the below screenshots, I have tried adding the different datapils for the watchlist, but I am not sure which shall work correctly. 
Please help me out.

1.

MohammedDaiyan_0-1726052460055.png

2.

MohammedDaiyan_1-1726052471091.png

 



Hi John,
Thanks for replying, I tried adding the flow variable and adding the script to it, but could not get all the group members added to the watchlist.

Please check the below screenshots, I have tried adding the different datapils for the watchlist, but I am not sure which shall work correctly. 
Please help me out.

1.

MohammedDaiyan_0-1726052460055.png

2.

MohammedDaiyan_1-1726052471091.png