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

Sheldon  Swift
ServiceNow Employee
ServiceNow Employee

Hi @Steven Parker - It looks like your subflow input is Array.String, so it wants an array of string primitives. Just pass it like inputs['pcname'] = [current.variables.computer_name.toString()]. Don’t use .join(), that collapses the array into a single string.

That change allowed the Sub Flow to run, but it's returning this error:

StevenParker_2-1758917857969.png

 

StevenParker_1-1758917816392.png

 

Testing the workflow manually and just providing the RITM sys_id, the PC Name, and the Group ID works perfectly....no issues.  But when I try to use the code snippet in a simple catalog item workflow run script is where this is occurring.

 

I really hope this isn't another issue with Sub Flow and Input Strings and the Flow being eratic or inconsistent like I know exists already.  When I compare the Flow Execution of a manual run and the catalog item run, they look identical.


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

What happens if you fix the case of the input names to match exactly what the subflow expects (e.g. pcName, groupID, ritm)? I've been somewhat removed from this area for a while now, but I think flow inputs are case-sensitive...so mismatched casing can cause the array to wrap in an object instead of being passed directly.

Left of the image is the catalog item run and the right is my manual "TEST" run....no difference.

 

StevenParker_4-1758918605916.png

 


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