Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Set import set row state to 'error' from source script in field map

tchaikin
Giga Expert

I'm trying to set an import row error from a source script in a field map.

 

Here's the code I'm using:

source.setValue('sys_import_state_comment', "There was more than one result returned for " + source.u_employeeid + " or " + source.u_objectguid);
source.setValue('sys_row_error', "There was more than one result returned for " + source.u_employeeid + " or " + source.u_objectguid);
source.setValue('sys_import_state','error');

 

Only the first line seems to actually have any result. The row I expect to be in "error" state is "skipped" instead, and my custom error is not written. What am I doing wrong? Is what I'm hoping to do impossible?

tchaikin_0-1672417046704.png

 

1 REPLY 1

Sai Kumar B
Mega Sage

@tchaikin 

I believe the OOB import set validations are overriding your custom error message and state value, I can see the system is not setting the error message as well as per your script. To override the error message and state value you can write a Business rule for that specific transform map on the Import set row table.