In Flow Designer - how do add people to the watch list

Jon57
Kilo Expert

I am currently working on a new flow where it simply updates the record in the following 2 fields:

Assignment Group = xxxx (i know how to do this part)

Watch List = multiple people (cant seem to get this part to work) 

My question is, how do you list out multiple people on this field. Is it by email, name, etc trying to keep this as low/no code as possible. 

 

Thank you

17 REPLIES 17

Jon57
Kilo Expert

Neither of those does as needed, does anyone know a script i can add/use to add multiple users to the watch list 

 

When i go to set up the flow, i have it update a record>requested item record>fields is Watch List, you can use this button -- find_real_file.png to add a script, (i have a feeling this is the only way it will work since the low/no code option doesnt seem to work as intended)

 

Currently it just has the generic script:

 

/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/

 

Hey

Here's what you need.

find_real_file.png

Only now you need to be clear about the users you need to add to the watch list.

In this flow i had looked up for 2 records from the sys_user table in step 1 and 2 of the flow.

Hence in the code i have referenced _1_look_up_record & _2_look_up_record

Keep that in mind. And this one works -

find_real_file.png

If you need any further assistance please let me know

Excuse my JS ignorance, do i change the "user1" or the "user1+" to the persons name or user ID in our system?

Let me explain :

var user1 = fd_data._1_look_up_record.record.sys_id;

user1 is just a variable declared to store the value of sys_id field of the user record (sys_user).

As i earlier mentioned, in my Action 1 & Action 2 of the flow i have looked up for random user records from the sys_user table, one user whose department is IT and other  whose department is Customer Support.

find_real_file.png

find_real_file.png

Now that we have the user records referenced, we can use them using the fd_data object. It is the global object of the flow designer.

So, _1_look_up_record & _2_look_up_record; these record objects are created automatically.

You can refer to all the records from the previous actions using the fd_data object, just use the '.' operator (dot-walking) as shown below -

find_real_file.png

So again using dot operator we reference the fields of this record and we select the sys_id of the user.

Likewise for all users who are to added to the watch-list, create a variable and store the respective sys_id.

Now we just return the all the sys_ids but with a comma in-between. And in javascript a string needs to be declared in between ' '. That's why comma is declared in between - ','.

Also when we have to concatenate variables and strings we use + operator. thus every sys_id is preceded by a + operator and also the comma in-between (',').

Only the first sys_id is not preceded by a + operator, as you know when adding 2 numbers we require only 1 + operator and not 2. Hope, my explanation is clear and comprehensible.

 

Now you have to decide which users you want to add to the watch-list. If the user values are going to be static then you can just copy the sys_ids of them, separated by a comma, and return this string.

I apologize that i keep having issues, when i try to get it to work i get an error from servicenow -- here is what i have set up

 

find_real_file.png

 

And here is the error i get: 

find_real_file.png

 

Obviously i am not doing this correct ... any direction would be appreciated