business rule triggered by an event

r_gissarl_
Mega Expert

Hi,

I'm facing a problem with business rules. I know that a common way to use BR is to trigger an event when some prerequisites are met. But I need to do the opposite way.

I have an event named "email.failed" that is inserted in the sysevent table by an inbound script (gs.eventQueue("email.failed", sys_email, email.from, sys_email.sys_id)). I want my BR to modify the state of the source email when the event is created. So I created this BR (After, insert and update) :

Sélection_482.png

As you can see, the source email should be in error state after the sysevent is created (parm2 contains the sys_email sys_id).

My problem is that the business rule is not ran when the sysevent is created ! The gs.log never shows in the logs.

If I go on the event and I click to Reprocess event, the BR is correctly ran and is doing the needed operations !

Do you have any idea on why the business rule is not triggered on the sysevent table ?

3 REPLIES 3

Uncle Rob
Kilo Patron

Script Actions are a good tool to use when you want Business Rule type functionality, but only when an event is fired.



Script Actions - ServiceNow Wik


Thanks Robert, I didn't know about script actions...


They're a lesser known, but awesome tool.



Slam that correct / helpful button.