Business rule does not seem to fire on "insert"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 10:12 PM
I've a BR set up on the incident table with the following conditions:
When to run: after
Order: 200
Insert: true
Update: true
Filter condition: (the highlighted part is what I'm expecting to become true)
But when incident is created and "Is Child" becomes true, the BR is still not firing.
I know the BR is not firing because:
(a) I put a gs.log statement on the 1st line of the BR under "Advanced" and it's not showing up in the log table
(b) I enabled the session debugger and it did report that the BR did not fire because the condition did not match. Now my question is is there a way to know from the debugger why the condition did not match?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 02:21 AM
> Changes to condition will not work on insert
Don't think this is entirely true as I've seen it run intermittently in some cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 11:34 PM
- remove the changes to condition and just put 'is' there just for testing and you will see your Brule triggers
Probably this is what will work. But I'll need to check with the team about the impacts since that BR is used by multiple teams.
Since your condition depends on the 'Is Child' field, you need to print and check whether this 'Is Child' field is actually turning to true or not before the Brule runs
Is there a way to know what the value of the field is at run time (i.e what value was the BR finding it to be when it was evaluating the condition)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 12:59 AM
Hi Nisar,
There is a simple way.
Remove the 'is child' condition from the brule conditions and then trigger the brule.
Use the 'previous' and 'current' object in the script to print the value of 'is child' field. Like:
gs.info("previous.u_is_child : " + previous.u_is_child); // gives value before the value changes
gs.info("current.u_is_child : " + current.u_is_child); // gives value after it changes.
In your case, both logs should have the same value and that is why your brule is not triggering. means the is child field value is either not changing at all or its changing before your brule runs so current and previous have the same value.
Let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 04:18 AM
UPDATE:
The "changesto" started to work again on "insert" operation after a day or two. No change was made to the either the BR or any script.
So @arnabwa you might be incorrect when you say "changesto" doesn't work on insert BR
However, the mystery still remains. Why did it not work on a particular instance and what made it auto-resolve on its own.