gs.eventQueue parm1 & parm2 are in event log, but can't pass to email notification

Frank Furter
Tera Contributor

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')?

 

 

1 ACCEPTED SOLUTION

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!

View solution in original post

12 REPLIES 12

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!

Bingo! That did it. Always something simple....lol. Allen, I *really* appreciate you hanging in there with me as I learn this process. This has been very valuable to me, and I greatly appreciate your time. Thanks so much!

Hi @Frank Furter 

It's no problem, haha. I appreciate you allowing me to work through this with you. Glad you got it resolved, take care! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!