Current.xxx returned string "null" in business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 02:38 AM
Hi all,
I am using current.xxx or current.getValue("xxx") in business rule for getting a reference field.
The reference field was set to empty, however, I got a string "null" so that I cannot use some function to check if the field was empty, because a string "null" is also "has value".
How to check a reference field is empty in the business rule?
Regards,
Ming
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2021 07:40 AM
There are a few ways you can check for this. One is above, the others that I know are
if(!current.field){
//Do work
}
if(current.getValue("field") != "null" && current.getValue("field") != ""){
//Do work
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2021 01:24 AM
The root cause maybe in transform map "copy empty fields" option.
If this check box was checked, if empty value was set to a reference field, in business rule, current.xxx will return a value "null" string. This maybe a problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2021 01:31 AM
Try
if(JSUtil.notNil(current.XXX))
{
//do something
}
This checks for '', null and undefined
-Anurag