Business rule does not seem to fire on "insert"

Nisar2
Mega Guru

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)

Nisar2_0-1712898417840.png

 

But when incident is created and "Is Child" becomes true, the BR is still not firing.

Nisar2_4-1712898561685.png

 

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?

 

 

8 REPLIES 8

> 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.

- 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)?

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. 

Nisar2
Mega Guru

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.