Business Rule fires on empty field value despite filter conditions

Matthew Johnso2
Tera Contributor

Hi everyone,

 

I've currently got a business rule set up to send a REST message to another instance, provided certain fields on a form are not empty. There are multiple other filter conditions, but all need to be true for the rule to fire. Among the conditions are that two fields, <correlation_id> and <correlation_display> not be empty. That way, if either ARE empty, it should fail the condition check and not run. And in most cases, this is successful.

 

fieldnotempty1.png

I've recently discovered that this business rule has fired a few times, even when both the designated fields ARE empty, and I suspect it has something to do with how it interprets NULL values.

 

In the business rule script, it sets a field on the target instance's staging table, <u_correlation_id>, to match the value of <correlation_id> from the incident in our instance. Likewise it matches <u_inc_reference> to <correlation_display>.

 

fieldnotempty3.png

 

I've got logs of the payload that is sent, and it confirms that the values of <u_correlation_id> and <u_inc_reference> are NULL.  

 

fieldnotempty2.png

 

Since u_correlation_id is pulling from correlation_id, and u_inc_reference is pulling from correlation_display, this confirms that both of these fields are NULL, and since a condition of the business rule firing is that those same fields NOT be empty, why is it firing anyway? Do "not empty" and "not null" mean different things in this scenario? I tried adding a line to abort:

 

if(current.correlation_id == '' || current.correlation_display == '')
 

But it still fired. So looking for a deeper understanding of null vs empty, and how I might adjust the filter conditions or script to ensure this scenario doesn't happen again.

 

Thanks

 

1 REPLY 1

Bert_c1
Kilo Patron

I suggest you use the Debug Business Rule feature, a very nice tool.