After Query Business Rule (sys_audit)

stevejarman
Giga Guru

I'm trying to create a Business Rule that fires after query of sys_audit, when the new value field of the record contains a URL. For some reason though, the Business Rule never fires, even though I'm definitely meeting the conditions. Can anyone think of any reason why it wouldn't work?

I've tried just setting the script to nothing but a gs.log and the message never appears in the log.

Screen Shot 2018-01-24 at 10.17.18 am.png

10 REPLIES 10

Doesn't BEFORE QUERY take place before a recordset is acquired though? i.e. BEFORE QUERY has no current?


You are right before query will execute before recordset is acquired. AFTER BR is only triggered when the user submits the form i.e, in this case, it is skipped as query is only evaluated in BEFORE BR. You can see the evaluations when you turn on the debug business rule.


So I guess really the answer is that there's no such thing as an AFTER QUERY Business Rule.



I just tried another AFTER QUERY on Incident table to just print a gs.log(current.number). Then I opened a few incidents and nothing was reported to the log.



Then I switch it to a BEFORE QUERY and that works, but as expected, current is not defined (because we haven't performed a query yet).



Hmm... not sure how to solve my original problem then, but it looks like a business rule won't be the answer.


I'm able to execute the BR on audit table in case of Insert i.e AFTER insert. Do you see the same behaviour Steve at your end?


That's weird as it contradicts that statement in the documentation ("To prevent performance issues and infinite loops, the system skips any business rule or workflow triggered by inserts to the Sys Audit table.").



It wouldn't help my situation anyway as I need to alter the data at the time that it's queried.