How to fix it
- Navigate to
System Import Sets > Administration > Transform Mapsand open your problematic transform map. - Click the Field Maps tab and identify any field mappings that use
setMandatory()in their transform scripts. - Go back to the transform map record and scroll to the Advanced tab to locate the
Scriptfield for onBefore processing. - Add validation logic in the onBefore script. For each required field, add:
if(!source.u_your_field || source.u_your_field == '') { ignore = true; info('Skipping record due to missing required field: u_your_field'); } - For multiple required fields, structure it like this:
// Validate required fields
var requiredFields = ['u_field1', 'u_field2', 'u_field3'];
for (var i = 0; i < requiredFields.length; i++) {
var fieldName = requiredFields[i];
if (!source[fieldName] || source[fieldName] == '') {
ignore = true;
info('Skipping record due to missing required field: ' + fieldName);
break;
}
}
- Remove or comment out the
setMandatory()calls from individual field map scripts since they don't enforce import validation. - Click Update to save the transform map changes.
- Test the fix by running a transform with records that have blank mandatory fields. Navigate to
System Import Sets > Import Setsand process a test import set. - Check the Import Set Run results - records with missing required fields should show as Ignored with your custom info message in the error log.
Using ignore = true will skip the entire record, not just the empty field. If you need partial record processing, consider setting default values instead of ignoring records.
- Alternative approach - if you need to set default values instead of ignoring records, modify the onBefore script:
// Set default values for required fields
if (!source.u_required_field || source.u_required_field == '') {
source.u_required_field = 'Default Value';
info('Set default value for u_required_field');
}
- If you still need UI-level mandatory enforcement, set the field to mandatory in the Dictionary Entry rather than using
setMandatory(). Navigate toSystem Definition > Dictionaryand find your field.
Enable 'Debug transform' in your Import Set to see detailed logging of field validation and ignore decisions during testing.