How to call email script from business rule event
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 12:11 AM
Hi,
I have to send a notification to one specific group when the seating type changes of the user from SC tasks.And I want to capture task details in notification but I have configured notification in the sys_user table and I am triggering this from the business rule event.
But I want to capture task details for that I am trying to call the email script but I am getting fail.
Business rule
Business rule--
gs.log("Test1 " + " Outside");
var group = gs.getProperty("it_group");
var seating = new GlideRecord("sc_task");
seating.addQuery("requested_for",current.sys_id);
seating.query();
if(seating.next()){
gs.eventQueue("it_notification",seating,group,seating.sys_id);
gs.log("Test2 " + " Inside");
gs.log("Test3 " + group);
}
Email script
Email script-
gs.log("Test emails " + event.parm2);
var task = new GlideRecord("sc_task");
task.addQuery("sys_id", event.parm2);
task.query();
while(task.next()){
gs.log("Test emails inside " + event.parm2);
}
Please help me and guide me here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 12:19 AM
Hi @lucky24
try the below code in the email script.
var task = new GlideRecord("sc_task");
task.addQuery("sys_id", current.sys_id);
task.query();
while(task.next()){
gs.log("Test emails inside " + event.parm2);
}
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 12:23 AM
Why are you triggering it on the user table? Why not on the sc_task table? Looking at your query: that's the seating.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark