- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 11:24 AM
I am triggering notification through event where I am passing array as PARAM but they were coming as one after one in notification but expectation is one in one line. I tried with below code but not working?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 09:41 AM - edited 08-26-2024 09:43 AM
Pass it as a comma spirited array when you call the event. Then use a mail script to print them in the email line by line. In your notification it to call a mail script your do ${mail_script:scriptname}
Your mail script should look something like this. This is based off your current code already having the display value rather then the sys_id.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var Persona = event.parm1.toString().splite(",");
for (var i = 0; i < Persona.length; i++) {
template.print(Persona[i] + "</br>"); //use /br instead of \n becasue it is a new line in HTML in a notification
}
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2024 06:03 AM
I am not sure how to proceed.
here if I observed a change in Table A record based on it I am fetching the records of Table B where the modified Table A record is part.
If don't use BR how do I trigger notification based on Table A record change?
let me know if you have any idea over it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2024 07:49 AM
Hello @KM SN
I guess you achieve your expected result, by passing the concatenated string to the event queue instead of the array. Here's the modified code:
Please try this :-
var multiplePersona = [];
var persona = new GlideRecord("u_user_persona");
persona.addQuery("u_sub_practice", 'CONTAINS', current.sys_id);
persona.query();
while (persona.next()) {
multiplePersona.push(persona.getValue('u_name').toString());
}
var valueString = multiplePersona.join(", "); // use comma and space instead of newline
gs.log('user persona list ' + valueString);
gs.eventQueue("user.persona.changed", current, valueString);
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2024 09:40 AM
But the client expecting it be one after another but not coma separated. don't we get one by one as shown below
**********
**********
**********