How to pass 4 arrrays at a time in event param 2? is it possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 03:48 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 03:51 AM
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.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 03:52 AM - edited 10-07-2022 03:52 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 05:53 AM
Hi,
As mentioned send it as JSON and then parse it in email script
What's the issue you are facing?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 06:04 AM
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.