Quebec - Flow Designer and List Collector Variables

Herb2
Tera Expert

In previous releases of ServiceNow the List Collector variable in Flow Designer was treated as a comma separated list of sys_ids. This caused some issues with Flow Designer that required using Custom Actions. I have several custom actions that use a List Collector as the input and then look up glide records on the sys_user table for example to generate a list of user's managers. My actions no longer work in Quebec, so it appearrs that list collectors are no longer working as comma separated lists. What type of variable are they treated as in Flow Designer, and how can i parse these lists so that i can iterate over them in my custom actions.

Here is a very simple custom action which works in a flow in Paris, and works when i use the Test function in flow designer in our Development instance which is on Quebec. However when i use this action in a flow in Quebec, the outputs for the action are blank. 

(function execute(inputs, outputs) {
var users = inputs.Users.toString().split(',');
var mgr_list = [];
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('sys_idIN'+users);
gr.query();
while (gr.next()) {
mgr_list.push(gr.manager.getValue('sys_id'));
}
  mgr_list = mgr_list.toString();
  mgr_list = mgr_list.split(',');
  outputs.managers = mgr_list;
  
})(inputs, outputs);

Here it is used in a flow, and does not successfully return the Manager objects from the inputted users.

find_real_file.png

Here is the action

find_real_file.png

Here is a successful execution of the Test function. 

find_real_file.png

1 ACCEPTED SOLUTION

The issue is identified an a product defect in Quebec release.

PBB# PRB1502254

Workaround: Check below SN Article.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0831321

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0827213

 

Thanks,

Rohit

View solution in original post

16 REPLIES 16

Herb2
Tera Expert

Thanks Ankur. My issue is not the For Each loop, though it is related to how Flow Designer handles list collector variables.

 

I have several custom actions that iterate through a list of objects. One is for sys_user to produce an array of user's managers sys_ids. Another is for the Okta Spoke table sn_okta_spoke_group producing an array of approval groups from sys_user_group for each okta group. Another is for a custom table producing an array from sys_user of System Owners. These actions are working in my Prod instance which is on Paris. However now in Quebec these custom actions have broken.

It seems to me that the issue is that Flow Designer in Quebec has changed how it handles List Collector variables and is no longer producing a comma separated list of sys_ids, which is what my actions rely on as input. 

Hi Herb,

It appears that you are absolutely correct. Flow has changed on my before as well and the only solution is to go and fix your existing flows as part of your upgrade plan. The List Collector variable no longer returns a string, it actually returns a Glide Record object. I have tried to parse this object to see if I can target one of the individual records elements, but have not had any success.

Curiously, if you log the List collector, the output DOES contain all the record objects, but trying to get the value using fd_data results in a empty value.

On the plus side, you can now use the For Each loop directly on the List Collector variable.

The issue is identified an a product defect in Quebec release.

PBB# PRB1502254

Workaround: Check below SN Article.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0831321

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0827213

 

Thanks,

Rohit

Thanks for pointing me in the right direction @Rohit Agarwal !

Wonderful !! Thank you !!