notification email script using array
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2016 11:41 AM
Hello,
We are struggling on how to show in email notification the list of systems impacted.
Here's how it shows in Change request table (they are comma separated since this is from list type of field).
So we thought of using array in our script...apparently it's not working for us.
template.print("Summary of Change:\n\n");
var gr = new GlideRecord("change_request");
gr.addQuery("sys_id", current.sysapproval);
gr.query();
while(gr.next()) {
template.print("1. Business and/or Technical Reasons: " +gr.u_bustechreason+ "\n");
template.print("2. Implementation Start Date/Time : " +gr.start_date+ "\n");
template.print(" Implementation End Date/Time : " +gr.end_date+ "\n");
template.print("3. System : " +gr.u_system.u_name+ "\n");
var list = gr.u_impacted_system.toString();
var array = list.split(",");
for (var i=0; i < array.length; i++) {
template.print("Impacted System : " +array[i].gr.u_impacted_system.u_name + "\n");
}
}
Appreciate any thoughts on how to display these Impacted system in our email notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2016 01:25 PM
Change your code like this:
var list = gr.u_impacted_system.getDisplayValue();
var array = list.split(",");
for (var i=0; i < array.length; i++) {
template.print("Impacted System : " +array[i] + "\n");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2016 06:45 AM
Thank You Mani this one works !!!!