Adding Multiple Users to Watch List Field via Flow Designer Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 01:31 PM
I have a string of user names or email addresses, separated by commas.
I need to add all those users to the Watch list field on the CSM Case (sn_customerservice_case) table using Flow Designer mapping.
Since the Watch list field is of type List (reference to sys_user), I cannot return a plain comma-separated string directly. Instead, I want to ensure that all valid users from the input string (if they exist in the system) are added to the watch list correctly.
How can I achieve this using inline script in field mapping, so that all valid users are included in the Watch list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 12:48 AM
Create a flow variable of type string.
Then do a 'for each' on your input string and a lookup to the user table for each of them (use name/email to find the user's sysID.
Then use the 'set flow variable' logic to update the flow variable.
Within that logic, use the script step to first set the current value of the variable (because it can already contain values from the previous iteration):
var newValue;
var currentValue = fd.data.variable (my PDI is asleep, so I don't have the exact code)
if(!currentValue){
newValue = [datapill of sysID of your user record];
}else{
newValue = currentValue + ',' + [datapill of sysID of your user record];
}
return newValue;
Then you can set the watchlist to your flow variable (but to be full proof, also do that with the same scripting to first check on the currentWatchlist on the record itself, so your variable doesn't overwrite any users already on the watchlist.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark