When bringing data into ServiceNow through a transform map there is one field on the Field Map record that can cause a lot of data issues if not used correctly: the Choice action field.
At first glance, the Choice action field looks simple. Only three choices exist in the dropdown: ‘create’, ‘ignore’ and ‘reject’. It defaults to ‘create’ and is hidden from the Field Map form for most target field types.
Where there can be issues is when the field you are writing your incoming data into is a reference field type. Reference fields in ServiceNow help users display data from another record on a form. They do not hold a text value in the database, but instead contain the unique identifier (sys_id) of the record that is referenced.
How the import functionality handles reference fields is by trying to match the value passed from the Source field on the Field Map record to the display name of the referenced record. (This can be configured to use another field on the referenced record to match by adding that field name in the Referenced value field name field on the Field map record.)
For example, if you are trying to fill in a user’s Department from an import, the system looks at the department value from the Source field on the Field Map record and tries to match it with the Name field on the Department table. If a user has a value of ‘Legal’ coming from the imported data feed and there is a department record with a name of ‘Legal,’ that department record will now be displayed as the value in the user’s department field. Where this gets tricky is if there isn’t a department record with the name of ‘Legal’. That is where the choice action value on the field map record comes in.
Choice action values
If the Choice action field is set as ‘create’, this will create a new record on the Department table and associate that to the user. This can cause issues if you have another import that is bringing in Department values. By leaving this Choice action field at ‘create’ you could potentially have two sources creating conflicting records on your Department table. It is recommended if you have a separate import to the referenced table (in this example the Department table) you not choose ‘create’ as an option.
In the above scenario, if you have a separate Department import, you would want to choose another option for the Choice action field: ‘ignore’. Choosing ‘ignore’ will allow the import to search for the value on the Department table, but if the query doesn’t find a Department value that matches the import, it will ignore the Department field in the import and leave the user’s department value as blank.
The third option for the Choice action field value is ‘reject’. If ‘reject’ is used in the above scenario and the import doesn’t find a matching Department record with the value of ‘Legal’, it will reject the row altogether. This would prevent the User record from being inserted or updated. This could lead to users missing from the system.
For more information on import sets in ServiceNow, review the documentation at https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/import-sets/concept/c_ImportDataUsingImportSets.html