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.

How can we push errors into an error field of sys_import_set_row table via transform map script.

Aanchal Mehndi1
Giga Contributor

How can we push errors into an error field of sys_import_set_row table via transform map script.

I have written few validations in a transform map script, which will ignore the row if condition doesn't matches.As there are many scenarios so I want to push the information in the error field of sys_import_set_row table that why row got ignored.

I didn't see any function in wiki that we can use to push error to error field of sys_import_set_row table via transform map script.

Does anyone have any solution?

11 REPLIES 11

ohhgr
Kilo Sage

Hi Aanchal,



I used the Comment field earlier to put the errors/comments that I generated. You just need to add following line in your onBefore script



source.sys_import_state_comment = "your_error_message";



Not sure about the way to use the Error field though, it being a reference.



Hope that helps,


Mandar


Thanks Mandar. This can be workaround but in this some default text i.e. "Row transform ignored by onBefore script" is getting appended with my error message.


I checked this is not a default value. Do you have any clue from where it is coming. I don't want this text.I just want error message which I have included in the script.


Transform script:



error = true;


error_message = "message";


ChrisBurks
Giga Sage

I would imagine you would use the same syntax for the error field:


ie - source.sys_row_error = " your_error_message";