How to Skip Record in Transform Map Field Mapping Assistant

Deepika Mishra
Mega Guru

Hi everyone,

I'm facing an issue with my field mapping assistant for a transform map. I want to skip the record if it hits the else loop in my code block. I've tried using abort, error, and ignore, but the record is still being updated with an undefined value instead of being skipped or ignored.

 

(function transformEntry(source) {
    var tabelGR = new GlideRecord('table_name');
    tabelGR .addQuery('tabel_number', source.u_tabel_number);
    tabelGR .query();
    if (tabelGR .next()) {
        return tabelGR .tabel_number;
    } else {
        source.sys_import_state_comment = "Tabel number not found: " + source.u_tabel_number;
        source.sys_import_state = 'error';
        // Here I have used all set of action such as abort, ignore and error but in all case it is updating the record with either false or undefined which I don't want. I want that specific record to be either skipped or ignored
    }
})(source);

 

1 ACCEPTED SOLUTION

Deepika Mishra
Mega Guru

After a lot of hit and trial got the resolution by adding the below part in else block. In this case it ignores the record for which the value didn't match.

else {
        source.sys_import_state_comment = "Tabel number not found: " + source.u_tabel_number;
	source.sys_import_state = 'error';
        transform.setAbortAction(true);
        return;
    }

 

View solution in original post

2 REPLIES 2

Deepika Mishra
Mega Guru

After a lot of hit and trial got the resolution by adding the below part in else block. In this case it ignores the record for which the value didn't match.

else {
        source.sys_import_state_comment = "Tabel number not found: " + source.u_tabel_number;
	source.sys_import_state = 'error';
        transform.setAbortAction(true);
        return;
    }

 

Hello,

 

where exactly did you created this script? In transform map scripts? Or in field script? I am trying to achieve similar thing but it is not working for me.

 

Thanks