Passing data to a Sub Flow Input of Array.String type

Steven Parker
Giga Sage

So I have a Sub Flow with an input variable of type Array.String and it's named 'pcname'.  If I test the flow and just type a name in there it works fine.  However, when I use the Code Snippet and try to pass a string variable (converted to an array) to that Sub Flow input, it errors out.  

 

How do I pass data to the 'pcname' "Array.String" input variable on the Sub Flow?  I am just passing 1 variable for now.

 

StevenParker_0-1758914923152.png

 


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

As suggested in the script editor when first expanding it, you need to return something, and the 'current.variables' convention used everywhere else in ServiceNow is a foreign concept to Flow Designer.  So in a simplified example when you add a Subflow action and toggle the script, a one line script would be similar to 

return fd_data.trigger.request_item.variables.computer_name;

when you type fd_data. you'll see a prompt for the next available option, then even though 'variables' doesn't prompt, it works.  Once you can get a Catalog Item variable passed into a Subflow string input, you would use the same syntax in your script pushing that variable to an array, etc.  You drag a data pill or write a script for each subflow input individually, so your try block is not needed.

 

I am working in a workflow and using a Run Script to call a sub flow


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven