Calling eventQueue(<event>, gr, "...") to trigger Notification, but it does not run

thomaskennedy
Tera Guru

I have an after-insert business rule that I want to use to trigger an email notification. The Notification's When to Send is Event is fired. The business ruIe runs to completion and prints the gs.info() statements as expected. I fire the event, but the notification does not run and no email is generated. What am I doing wrong?

Business rule

(function executeRule(current, previous /*null when async*/) {
	var recipients = "";
	var event = "x_acso_rf_poc.rf.sr.notification";
	var property_root = "x_acso_rf_poc.rf.sr.notification.recipients.";
	
	gs.info("Business rule 'RF Service Request En Route for Service' running");
	
	if(current.getDisplayValue("u_site").toLowerCase().contains("xxxxx")) {
		
		gs.info("Raising event using xxxxx recipients");
		
		recipients = gs.getProperty(property_root + "xxxxx") || "";
		gs.eventQueue(event, current, recipients);
		
	} else if (current.getDisplayValue("u_site").toLowerCase().contains("twiggs")) {
		
		//etc
			
	} else {
		gs.warn("Site not recognized! No notification will be sent.");
	}
	
	gs.info("Business rule complete");
	
})(current, previous);

 

find_real_file.png

 

find_real_file.png

 

find_real_file.png

find_real_file.png

 

 

 

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi @thomaskennedy 

There could be numerous reasons why the notification isn't sent. We don't know what you've researched before this (hopefully, you've done some). There are numerous posts on the forums about this same situation and I've personally have responded with 8-10 bullet points of things to check.

Feel free to search the forums as there's great information out there.

Luckily, someone has already asked about you to clarify if the event itself even shows in your logs (you should have checked that first and foremost after seeing the info in your logs).

From there, if send to event creator, parm1 contains recipients is checked, no advanced condition on the notification (or ensuring it returns true if so), the notification is active, mail script, if used, isn't broken, which causes problems, the recipient is active and has a valid email primary channel setup in their preferences AND notifications turn on....and you don't have a before business rule on the sys_email table that may be aborting this....it should send.

Please mark reply as Helpful/Correct, if applicable. Thanks!


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

View solution in original post

13 REPLIES 13

Recipients is populated from a property, half way down screen shot #1. The property is my email address. I'm logging that out (not shown above).

Aman Kumar S
Kilo Patron

Hey,

Check if email sending is enabled in your system.

Go to left navigation > Type Email properties > Check

Also, to check if the notifications are being sent, you can check in SN itself

Go to left navigation > Type Outbox 

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Yes emailing is enabled. I've found only one scenario where it sends an email, and that is if I check Send to Event Creator. Even that does not send consistently.

Well, the very reason flag "Send to Event Creator" exists is to enable sending e-mails even if the recipient and the user generating the event are the same person.

In other words, what you are experiencing is intended functionality working as designed. If you want to test with "Send to Event Creator" unchecked, use an e-mail address that does not identify your user.

RaghavSh
Kilo Patron

1. Check event logs and search by name if your event is getting fired.

2. In the same event logs check if parm1, parm2 and table have correct values.

After that we can check the issue with notifications.


Raghav
MVP 2023