ISSUE : Get List Collector Value in Flow and use value in FOR EACH loop

Sohail Khilji
Kilo Patron
Kilo Patron

Dear Community !

 

I have an issue with a list collector field value in flow desinger.

 

Objective : 

I want to collect the list of CIs in a list collector and use in flow designer to set them as Non-Operational. I tried to create a custom Action and use in flow to parse with split(','). But had no luck. Seems like the issues is with input and output value types such as array.object or array.string.

 

i Tried both but no luck, in flow log i get return value as [Object Glide Record].

 

Error Log:

SohailKhilji_0-1690362452211.png

 

INPUT:

SohailKhilji_1-1690362532413.png

 

SCRIPT : 

SohailKhilji_2-1690362583104.png

 

 

OUTPUT:

SohailKhilji_3-1690362605918.png

 

SohailKhilji_4-1690362628685.png

 

@Ankur Bawiskar , I refered to your article too... can you help in this case?

@Community Alums , @Sagar Pagar.


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

1 ACCEPTED SOLUTION

Josh Pirozzi
Kilo Sage

Hey @Sohail Khilji,

 

Thanks for your details here! We've been trying to work on a similar dev effort and the Custom Action isn't working for us either. 

 

I'm not sure if you're still experiencing this issue/situation, but I was able to come up with a potential solution without using the Custom Action. See my comment on: https://www.servicenow.com/community/developer-blog/using-list-collector-in-flow-designer-for-each-l...

 

Thanks,

Josh Pirozzi

View solution in original post

5 REPLIES 5

Nishita Padwal
Tera Contributor

Hello @Sohail Khilji ,

 

In the script step where you are populating the output.variable, instead of adding -

 

outputs.variable = inputs.variable.toString().split(',');

 

please replace with the below line -

 

outputs.variable = JSON.stringify(inputs.variable.toString().split(','));

 

This will definitely remove the "[object GlideRecord]" output.

 

Hint: JSON.stringify() takes a JavaScript object and transforms it into a JSON string.

 

Please mark the answer as correct if it helps!

Thanks,

Ni**bleep**a

Sohail Khilji
Kilo Patron
Kilo Patron

@Nishita Padwal , Thanks, That works but,

 

cant use the output of action in ForEach condition. I tried to log both varaibles but i get runtime value as empty.

 

SohailKhilji_0-1690367076818.png

SohailKhilji_1-1690367232374.png

 

 

Any suggestions ? 

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Josh Pirozzi
Kilo Sage

Hey @Sohail Khilji,

 

Thanks for your details here! We've been trying to work on a similar dev effort and the Custom Action isn't working for us either. 

 

I'm not sure if you're still experiencing this issue/situation, but I was able to come up with a potential solution without using the Custom Action. See my comment on: https://www.servicenow.com/community/developer-blog/using-list-collector-in-flow-designer-for-each-l...

 

Thanks,

Josh Pirozzi

Hi ! 

 

If you could share the script, it will be helpful for future readers because this is a common issue observed by all users of get catalog Variables action.


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect