- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 11:05 AM
Hello Team,
I have two arrays where I am using diff to get the difference and push it into another array as below.
arr_diff = arrayUtil.diff(arr1, arr);
The values comes up like this as below.
arr_diff = test1,test2,test3,test4
With the help of below script I am trying to keep a new line while pushing into email notification
var ritmdescription = '';
if (arr_diff.length > 0) {
for (var m = 0; m < arr_diff.length; m++) {
ritmdescription += arr_diff[m] + "\n";
}
}
I am trying to push the array values into an email notification with an event as below
gs.eventQueue("integration.test", current, ritmdescription);
and expecting the results as
test1
test2
test3
test4
In notification body, I kept event.parm1
But the end result comes up as below.
test1 test2 test3 test4
Please let me know how to add a new line after each value of the array.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 04:11 AM
Instead of loop, I used a join('<br/>') directly with diff function and that did the trick.
arr_diff = arrayUtil.diff(arr1, arr).join('<br/>');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 11:25 AM
Hi Aditya,
Have you tried it using instead of loop :-
arr_diff.join('\r\n');
Regards,
Rahul
Thanks and Regards,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 04:09 AM
Hello Rahul,
It still doesn't work and printing the values in the same line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 04:11 AM
Instead of loop, I used a join('<br/>') directly with diff function and that did the trick.
arr_diff = arrayUtil.diff(arr1, arr).join('<br/>');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2023 11:24 PM
Hi,
I am trying to create the same using scheduled job can you share the script to check and implement the same in my instance?