- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-14-2022 09:15 AM
Hi,
I have a custom table that holds the user data and the application assigned to that user. This application field type is a list type (glide list), so that whenever new application gets added to the user it should be stored in that field for that user record, and when that application is removed from the user - it also has to removed from this field.
This is done using a catalog item, when the user selects the application for an user and submits the form - after certain processes that application has to be added/removed from their user record.
As we are using flow designer for this item -
I would like to know how we can update the application value (that was selected on the form) to the application field (on the user's record in custom table)
- For adding application (CI) to the application field on user record.
I have used Update record (17) action to do it & the application reference is taken by using Get Catalog Variables action (1)
Screenshot-1
Screenshot-2
The problem I am facing is - the previous value is getting wiped off and the new value that was selected on the form is only shown up.
How can we achieve this. Please help.
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-14-2022 11:33 AM
Hi,
Since it's a GlideList you are using, the value stored are actually a comma-separated string of Sys IDs.
So to add an additional value to this list, you will need to make use of a Flow variable, and a bit of scripting.
Use the Flow variable to store the SysID of the record you want to add to the GlideList.
Then when updating the record script the new value of the list by doing something like this:
var watchList = fd_data.subflow_inputs.incident.watch_list.toString();
if (watchList == '')
return fd_data.flow_var.id; // list is empty just add the ID
else
return watchList += ',' + fd_data.flow_var.id; // list has values, add an additional value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-15-2022 11:51 AM
Hi
Thanks for your inputs!
I tried the steps that you provided, the value is getting added to the field successfully.
Highlighted the values in the code where the variables were replaced. As I was new to the flow scripts and this syntax helped a lot. Sharing it below for reference.
Code used -

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-19-2022 10:15 AM
Hi,
Sorry for the slow response...
As mentioned removing a value is a bit more complicated, but you can try something like this:
var someCommaSeparatedText = 'aa,bb,cc,dd';
var someArray = someCommaSeparatedText.split(','); // array should now look like this: ['aa','bb','cc', 'dd'];
for (i=0; i<someArray.length; i++)
{
if (someArray[i] == 'bb') // value you want to remove
{
someArray.splice(i, i);
break; // assuming only unique values in array, will stop the looping
}
}
someCommaSeparatedText = someArray.join(',');
gs.info('updated text: ' + someCommaSeparatedText);
return someCommaSeparatedText;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-14-2022 11:33 AM
Hi,
Since it's a GlideList you are using, the value stored are actually a comma-separated string of Sys IDs.
So to add an additional value to this list, you will need to make use of a Flow variable, and a bit of scripting.
Use the Flow variable to store the SysID of the record you want to add to the GlideList.
Then when updating the record script the new value of the list by doing something like this:
var watchList = fd_data.subflow_inputs.incident.watch_list.toString();
if (watchList == '')
return fd_data.flow_var.id; // list is empty just add the ID
else
return watchList += ',' + fd_data.flow_var.id; // list has values, add an additional value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-15-2022 11:51 AM
Hi
Thanks for your inputs!
I tried the steps that you provided, the value is getting added to the field successfully.
Highlighted the values in the code where the variables were replaced. As I was new to the flow scripts and this syntax helped a lot. Sharing it below for reference.
Code used -

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-19-2022 10:15 AM
Hi,
Sorry for the slow response...
As mentioned removing a value is a bit more complicated, but you can try something like this:
var someCommaSeparatedText = 'aa,bb,cc,dd';
var someArray = someCommaSeparatedText.split(','); // array should now look like this: ['aa','bb','cc', 'dd'];
for (i=0; i<someArray.length; i++)
{
if (someArray[i] == 'bb') // value you want to remove
{
someArray.splice(i, i);
break; // assuming only unique values in array, will stop the looping
}
}
someCommaSeparatedText = someArray.join(',');
gs.info('updated text: ' + someCommaSeparatedText);
return someCommaSeparatedText;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-07-2022 11:11 PM
Hi I used the same script to update the list collector field without removing the old entry that were already present.
Though i am seeing some update in the table , but i couldn't find the new entry.
Can you please help me
I am seeing the sys id alone in the outputs.
I created the flow variables as Reference record to cmdb_ci_service