- 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
03-10-2023 05:14 PM - edited 03-10-2023 05:15 PM
Hello,
Sorry, your post is a bit confusing because you say you have a mail script, but then in the notification message you're referring to them directly as ${event.parm1} and ${event.parm2}
What is your mail script actually showing when you call it such as: ${mail_script:name_of_mail_script}?
Your event should only be fired when the condition is relevant, not sure what you mean by "changes" condition, unless you mean you set that on the notification in addition to the event specification?
In any case, you have some speculation as well which is nice to see your thought process, but it's a bit confusing when you say: "I *think*, since I am not calling the event in my notification script".
I'd suggest you use appropriate conditions and/or script in your business rule and only fire the event when you're supposed to and not add any changes condition, etc. to your notification.
I'd also recommend setting a variable to the string values of current and previous and use those in your eventQueue script line rather than directly using current and previous objects.
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 12:47 PM
Thanks for marking my reply as Helpful.
Let us know if you have any other questions?
If my reply above also helped guide you correctly, please also consider marking it as "Accept Solution".
Thanks and take care! 🙂
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 07:34 AM
Hey Allen,
Im doing a simlar item but i only created a notificaiton the sysevent table and used the pill picker on the right to drag parm1 and parm2 into the body. Is there a additional step i need to complete to make this work?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 09:10 AM
Hi,
If your intended purpose is to send that notification with that value (or those values), then that's all you need to do 🙂
If you needed to do something with the parm1 or parm2 (such as use one of those to then query x table to find y record(s)) then you'd want to utilize a mail script -- leveraging those parms to then do whatever it is that you need.
Hopefully that all makes sense?
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!