How to pass 4 arrrays at a time in event param 2? is it possible?

Sathwik1
Tera Expert

I am having 4 arrays namely arr1, arr2, arr3, arr4.. and in each array will have more than one value..

 

Now I need to pass all these array at a time in event.parm1.. is it possible?

 

gs.eventQueue('eventname', null, passing some value in param 1, in parm2 I need to pass all those arrays)

 

is it possible?

 

@Ankur Bawiskar @SumanthDosapati 

4 REPLIES 4

AnubhavRitolia
Mega Sage
Mega Sage

Hi Sathwik,

 

If all Arrays contain same details and everyone need to be added as recipient of email notification, you can merge them in another array and call.

 

Or you can store all 4 arrays in JSON and can pass JSON value and than can parse that JSON where required.

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

Sagar Pagar
Tera Patron

Hi @Sathwik1,

 

pass the finalArray as param1 or param2.

 

 

Try this sample scripts -

 

var obj = {
array1:arr1,
array2:arr2,

array3:arr3,

array4:arr4,

array5:arr5
}

 

var finalArray = [];

finalArray.push(obj);

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

As mentioned send it as JSON and then parse it in email script

What's the issue you are facing?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Dave Clemmer
Mega Guru

The easiest way, if they're heterogeneous arrays that don't need to be differentiated, is to make an array of the arrays.  If they do need to be differentiated, making a Dictionary that labels each array would also work well.  As noted elsewhere, JSON would also work, but would be slower than either of these options.