The CreatorCon Call for Content is officially open! Get started here.

Business Rule - Before Rule only running once

justin_drysdale
Mega Guru

I have a before business rule that populates a field on the incident table with a value anytime the field is left blank and the user saves or inserts. It only seems to run one time, the first time a user clicks save. I've checked the condition and there is no .isNewRecord() or any other type of record age check. The condition is simple, if a certain field is blank, populate it at save, but it only seems to work on new records.

I've turned on business rule debugging to see if the business rule condition is being skipped. I see it show up at record creation where it is invoked. However if I blank out the field and click save, it will not repopulate the filed at all. The debug log doesn't even list the rule anymore.

I tried moving the condition down into the script as an if statement. However the rule still won't appear in the log after it's first invocation.

I've also tried lowering the BR priority to 50.

I am hesitant to share the code of the BR, but it does run/work the first time through. Please let me know if you'd like more information.

I am looking to see if there is any hidden "feature" I am missing.

Any advice is welcome.

4 REPLIES 4

sdarity1
Tera Contributor

The record field has a Null value First Time Insert and meets the condition of business rule during First Time Insert. Subsequent update of record the field might contain space which is greater than null and tricks the condition on business rule that field has a value. You might consider changing the condition of Business rule to evaluate if field is greater than space (i.e. field > ' '). This style of condition will evaluate correctly for both Insert and Update if field is Null (during Insert) or space (during Update).

Steve Darity
First American


Thanks, that did it.


bushra_akhtar
Mega Contributor

It might not be triggering at all at updates & only when the first time insert happens


CapaJC
ServiceNow Employee
ServiceNow Employee

How are you checking for empty? Are you using current.field_name.nil() ? That's usually the best way.