Issue Updating a list collector

Cirrus
Kilo Sage

Hi,

We have a product record with a list collector field that captures one or more systems involved in the product creation.

As part of a decommissioning process we initiate a flow that copies that field and passes it into a list collector variable.

No issues so far.

During decommissioning we may identify additional systems that we didnt know about, and the list variable is updated with these additional systems before closing the task.

Then end goal is to update the product record system list with the revised variable system list.

To achieve this we have the following steps in the flow:

Step 32: Get Catalog Variables // gets the most up to date list of the systems

Step 33: Set Flow Variables // has the following script: 

var list = fd_data._32__get_catalog_variables.dc_producing_system;
var listArr = list.split(',');
return listArr;
Step 34: Update Record // updates the Producing system field on the product record using the flow variable
 
In the flow execution, we can see that step 33 is returning a coma separated list of sys_ids - 

["cbd4004c1bc2d690ef6764a2b24bcb4a","04c1af451b858e503a3840c4e34bcb1d","fa0935cc1b958250ef6764a2b24bcb0c","a215c40c1bc2d690ef6764a2b24bcb55","a1e1af451b858e503a3840c4e34bcb5e"]

However, the System field on the Product Record still only show the original 2 systems.

 

Can anyone advise how we can update the record with the revised list of 5 systems?

 

 

3 REPLIES 3

Runjay Patel
Giga Sage

Hi @Cirrus ,

 

Just return listArr.toString();

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

Thanks Runjay. Updated line 3 as you advise but its updating the field with the comma separated list of sys ids

Hi @Cirrus ,

 

Make sure these sysids are present on referenced table. 

I have checked this code in background script and working fine, it means it will work in flow as well.

 

var x = ["d64b9bd783095210a9589780deaad3c6","0e826bf03710200044e0bfc8bcbe5d7c"];

var gr = new GlideRecord('incident');
   gr.get('3d3acd498371d610a9589780deaad33e');
     gr.watch_list = x.toString();
      gr.update();

RunjayPatel_0-1732205547188.png

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------