Business Rule - Before Rule only running once
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2012 06:44 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2012 07:19 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2012 11:54 AM
Thanks, that did it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2012 01:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2012 08:18 AM
How are you checking for empty? Are you using current.field_name.nil() ? That's usually the best way.