"Copy empty fields" Transform Map question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 08:22 AM
I am importing data from a spreadsheet and am looking to overwrite target records' vendor number fields with empty data if the corresponding vendor number field in the spreadsheet is also empty.
I have checkmarked "Copy empty fields" as you would guess:
However, later, I have a business rule that runs based on if my vendor number field is empty. This business rule is not getting triggered since it now thinks the field value is "NULL" instead of just empty.
I use the following condition:
current.u_vendor_id_number.nil()
Why does a NULL field not count toward this condition?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 08:33 AM
Hi Mg,
What is the behaviour if you add that as part of condition filter in Business rule i.e vendor id number is empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 08:37 AM
It's unfortunately not something I can add to the business rule's condition builder - it needs to be an IF statement with the script section of my business rule, checking whether or not the field is empty.
I guess I am mainly looking for a safer, broader way to tell if if a field is empty. I know of the following:
- current.u_vendor_id_number.nil()
- current.u_vendor_id_number == ''
- current.u_vendor_id_number == 'NULL'
Is there a best practice on what covers the most scenarios for blank fields?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 08:51 AM
More confusion directly after transform...
Field: u_vendor_id_number
Value: (nothing, empty value retrieved from transform map)
"Before" Business Rule executed directly after transform:
Condition | Result |
current.u_vendor_id_number.nil() | FALSE |
current.u_vendor_id_number == '' | FALSE |
current.u_vendor_id_number == null | FALSE |
current.u_vendor_id_number == 'NULL' | TRUE |
Same "Before" Business Rule executed after normal update on record:
Condition | Result |
current.u_vendor_id_number.nil() | TRUE |
current.u_vendor_id_number == '' | TRUE |
current.u_vendor_id_number == null | FALSE |
current.u_vendor_id_number == 'NULL' | FALSE |
Definitely seems contradictory even though the field value is all the same.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 09:32 AM
Hi Mg,
Thanks for the update. I would need to test this once at my end and then get back to you. Meanwhile here is the link to helpful blog. Please refer the same.
Defensive Coding: Check your Variables in Customizations
Also JSutill has few methods to check if the field value is blank or not.