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.

Create ArrayList from array

palash0511
Giga Contributor

How to create arraylist from arrays?

I have number of arrays, I want to make arraylist of this arrays and pass it this arraylist as output of an activity. Is there any way I can achieve this?

2 REPLIES 2

oliverschmitt
ServiceNow Employee
ServiceNow Employee

Hi,



What exactly is the use case and what do you mean by ArrayList?



If you mean the java object ArrayList than I doubt that it is possible because direct call to the underlying java are mostly forbidden (with a few documented exceptions). In ServiceNow we code in JavaScript and not java. That means an array list would be something like this



var a =   new Array();


var b = {};


var c = {};



a.push(b);


a.push(c);


adi91221
Kilo Guru

Hi Palash,



Try this



var arraylist = array1.concat(array2,array3,array4,...);




Thanks


Adi