Import Sets – Enhancing Copy empty fields

General Add comments
by:

image002

ServiceNow has a nice feature to map empty fields when using transform maps to import data. When the ‘copy empty fields’ checkbox is checked it will map empty fields to the target record for each mapping that has been specified. That is also where the problem is. Often I had to import data and clear out fields but not for all mappings.

The functionality described in this blog will add some functionality on the mapping form so you can easily specify if a single mapping should map empty fields. The functionality makes use of the ‘Use source script’ flag and puts a script in the ‘source script’ field to clear the target field when the source field for the processing row is empty.

First create a true/false field on the Mapping form (sys_transform_entry table).
image004

I called mine ‘Map empty value’.

Next, create a UI Policy that triggers on the new field.

image006

Make sure the ‘On load’ flag is set to false.

That’s it. Now whenever the ‘Map empty value’ flag is set to true, the source script will be populated with a script to map the selected source field to the target field. Or clears the target field when the selected source field doesn’t contain a value.

image008

Tip: Make a client script that checks if the ‘Copy empty fields’ flag is set to true when you select the ‘Map empty value’ flag.

For questions or remarks please contact me at .img[at].img

Leave a Reply