how to use para2 in email script and fetch data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 12:23 AM
Hi All,
I have a scheduled job from where i am triggering an event and sending parm2,
i want to use this parameter in my email script to glide data from incident table.
gs.eventQueue("eventname","current", parm1, parm2);
now i want to use parm2 which contains sys id of incidents, in my email script to glide the incidents and get their category, state and configuration item and display it in tabular format.
Incident | Configuration Item | Category | State |
inc1234567 | xyz | xyz | xyz |
inc4546567 | abc | abc | abc |

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 12:28 AM
Hi @Priya75,
You can use event.parm1 and event.parm2 to read these from the event.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 12:45 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 01:58 AM
Hello Priya,
Firstly,pass allyoru incidents to array and thenpass the array in param2 of the event.
Then in your email script,you can access the data as event.parm2. Here is the sample code.
var sysIds = event.parm2.toString().split(","); //split the incident sys_ids
template.print("<table><th>Incident</th>Configuration Item</th><th>Category</th><th>state</th>");
for(i=0;i<sysIds.length;i++) {
template.print("<tr>");
var grInc = new GlideRecord("incident");
if(grInc.get(sysIds[0])) {
//form your table rows here.
template.print("<td>"+grInc.number+"</td>");
template.print("<td>"+grInc.cmdb_ci+"</td>");
template.print("<td>"+grInc.category+"</td>");
template.print("<td>"+grInc.state+"</td>");
}
template.print("/<tr>");
}
template.print("<table>");
Mark the comment as a correct answer and also helpful if this has helped to solve the problem.