How to pass more than 2 parameters to the eventQueue and access it on the notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 02:05 AM
Hi,
I am using an eventQueue on the scheduled job and passing object as a param1.
var arrFinal = [<sys_id> of users];
var obj = {
iteration: iterValIncFinalVal,
lastDate: storeValNextItr
};
gs.eventQueue('cmp_qualifier', gr, obj, arrFinal);
I need to access both the object value of event.parm1 to be accessible on the notification subject and body.
Can this be achieved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 02:40 AM
Hi,
Script looks fine and should work
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 02:43 AM
You can use template.print('<p>Iteration : '+getParamValue.iteration+'</p>'); to print these values in email Notification body.
Hope you are receiving these values in Logs when event is triggered.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 03:14 AM
Can we use them on the email notification subject?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 03:49 AM
Hi,
your cannot set them directly in the Subject field since you are scripting it
you can set the subject via email script using email.setSubject("My Subject");
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 04:03 AM
How to retrieve the object in email script the below script is not working.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var getParamValue = JSON.parse(event.parm1);
gs.info("getParamValue:" + getParamValue);
gs.info("getParamValue.iteration:" + getParamValue.iteration);
gs.info("getParamValue.iteration:" + getParamValue.lastDate);
email.setSubject("PI" + getParamValue.iteration + "Capacity Planning Worksheet");
template.print('<p>Hi Team,</p><br/><p>The PI'+ getParamValue.iteration +', capacity updates via <a href="https://'+ gs.getProperty('instance_name')+'.service-now.com/sp?id=sc_cat_item&sys_id=243101531243bc5506782145e153af9a&iteration='+ getParamValue.iteration +'by COB, '+ getParamValue.iteration +'">Plan Form</a>'+ getParamValue.lastDate +'</p><br/><p>Thank you!</p>');
})(current, template, email, email_action, event);
Error that i am getting in the log.
Can i use html tags in email.setBody() as that of what i have used in template.print() as per the above code.