Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How do you create an array field in ServiceNow?

John Lombardo
Tera Contributor

I am still relatively new to SNOW and I do read the documentation and I do search for help in the community. I could not find any help in either placess for this issue. Please forgive me if this is a stupid question but how do you create an array field in ServiceNow, or can you?

I went to Tables and created a custom table and then I went to Dictionary and started creating fields for the new table. Then it came time to create an array and the only field type I could find that I thought might work is Data Structure. 

Data StructureField that allows the selection of one of the following data structures and entry of values to organize particular information in the record.
  • String
  • Boolean
  • Integer
  • Decimal
  • Object
  • Array

I have no idea how to tell the system I want this to be an array. I suspect there may be a way to manipulate this type of field in a script but I need this to be on a form that users can input data into manually. Actually, I will need several array fields on the form for manual entry.

When I add the field to the form it is treated like a single string field. 

I have no problem manipulating arrays in javascript and elsewhere but the arrays were always fields in the database.  

Thanks,

John

2 REPLIES 2

SanjivMeher
Mega Patron
Mega Patron

You can create a List field which works like array, but it should be linked to a table.


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

John Lombardo
Tera Contributor

Hi Sanjiv,

Thank you for the suggestion. I don't think that will work for me though. The end game is that via Orchestration another app will have to come in and extract this data. Assuming I can get the data into the list the way I need to I'm not sure how much effort it will take to extract it in the way I need to. 

Normally an array would work here. I'm thinking that instead of putting the data into separate elements of an array field I will have to create separate records in the table where they would all be linked by a common field. 

Thanks again for your help. I will update this again if and when I come up with the right solution.

Thanks,

John