- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 03:25 PM - edited 03-10-2023 03:26 PM
I am working on a simple request - send an email notification when planned hours change (and include previous and current values). It is writing the correct current/previous values to the event log (parm1 & parm2), but I can't seem to figure out how to pass them to my notification script.
My Business Rule is set to Before Update, with conditions of Planned hours changes. I have this in my BR script:
gs.eventQueue("req_allocation.req_hours.changed", current, current.requested_hours, previous.requested_hours);
My Email Script looks like this:
var gdt = new GlideDateTime(current.sys_updated_on);
email.setSubject("Planned Hours Change " + current.resource_plan.number + " " + gdt.getDate());
(function runMailScript(current, template, email, email_action, event) {
template.print("PARM1: " + event.parm1);
template.print("<br>");
template.print("PARM2: " + event.parm2);
})(current, template, email, email_action, event);
I am trying to call the parameters in my message like this:
PARM1 - ${event.parm1}
PARM2 - ${event.parm2}
But on output I get:
PARM1 - 6816f79cc0a8016401c5a33be04be441
PARM2 -
I understood I needed to use an event, which I created and registered, but I also discovered you can't use the event in the notification script when your conditions are "changes".
I *think*, since I am not calling the event in my notification script, it knows nothing about the gs.eventQueue. But how do I refer to it when using "Changes" for condition criteria? (Planned hours 'changes')?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 06:19 AM - edited 03-16-2023 06:20 AM
Hi,
Sorry, I mentioned in one of my other replies that you should be firing that event when the condition has already been determined/evaluated. That means...the notification doesn't need to have the conditional on it. You would simply trigger the notification from the event firing. Please remove the conditional statements from your notification and simply use only...the event. That's why you're firing the event.
I believe I've covered this a few times and mentioned that you will not have access to parm1 or parm2 in your mail script thus it won't show in your notification body...if the notification is not triggered from an event.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 09:15 AM - edited 11-29-2023 09:18 AM
Thank you Allen, I appricate your guidance. Never done a mail script before myself. I am only intending to have those two values display the information in those two fields but when i try to hit preview email i dont see any values appearing.
I did not create any BR or anything else beside the notification i was hopign the OOTB funciton would work but im hitting a wall with my knowledge

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 09:52 AM
Hi,
If your notification is on the event table, you'd have access to those records and related values. Inside the message body, if you've used the field list on the right-hand side and selected parm1 and parm2 from the tree, it should have added something like ${parm1} or ${parm2} to it:
Then, if you select preview and pick an event record that actually has a parm1 and parm2 value, such as this event:
You'll see this in your preview:
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2023 11:54 AM - edited 03-15-2023 05:19 AM
Thank you for the prompt and thoughtful reply, @Allen Andreas. I apologize for the delay, work got in the way! 🙂
I had it semi-working, but for some reason it fails to create the email now. If I could indulge and share some screenshots? To recap - the request is to send an email when a field changes in the resource plan form. In this example, I'm focusing only on planned hours in the requested_allocation table.
My business rule appears to be working, I get the expected values in parm1 & parm2 in the event log:
(function executeRule(current, previous /*null when async*/) {
gs.eventQueue("req_allocation.req_hours.changed", current, current.requested_hours, previous.requested_hours);
})(current, previous);
I have an email script called 'Allocation_Change_notice_with_date' that contains this:
var gdt = new GlideDateTime(current.sys_updated_on);
email.setSubject("Planned Hours Change " + current.resource_plan.number + " " + gdt.getDate());
My notification is called 'Requested Allocation Change Notification' and looks like this:
I can't seem to figure out why the email is not firing. I had it working fine last week, but I think I've been staring at it too long. I still need to add code to the email script to obtain the previous/current planned hours, and figure out how those get passed into the notification.
I'm getting close, but can't get passed this last issue! Hope someone can help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 04:06 PM - edited 03-15-2023 04:09 PM
I mentioned most of what I'll say below, in previous replies, but perhaps there's still some disconnect.
You need to change the notification to trigger when the event (req_allocation.req_hours.changed) is fired.
Currently you have it conditional, etc.
If the notification isn't triggered by the event, then you can't tap into parm1 and parm2 in your mail script, etc.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 04:35 AM
Hi Allen - many apologies for the confusion (and the delay in replies - they were mistakenly moderating my posts, which they tell me has been corrected.)
I am unable to use 'Event is fired', as it gives me this issue:
So I have it all working now, as I mentioned, parm1 and parm2 are correct in the event log, I just can't get it to display those values in my email body.