- 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);
- 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
**********
**********
**********