After Query Business Rule (sys_audit)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 03:22 PM
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.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 04:40 PM
Doesn't BEFORE QUERY take place before a recordset is acquired though? i.e. BEFORE QUERY has no current?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 06:03 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 06:14 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 08:14 PM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 08:18 PM
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.