The CreatorCon Call for Content is officially open! Get started here.

System Import Sets - Transform Map - Setting an Error message

dstuart
Kilo Expert

I have quite a number of scheduled imports, with Transform Map scripts. I am trying to set an error message, so that when the Transform Map Script 'rejects' a record being imported, someone know why. 

I can set successfully set the error 'flag' so the record doesn't get inserted into the target table. 

I can log an error to the System Error Logs. 

What I can't figure out how to do is log an error message into the Error Message field on the Import Set Row Errors. 

 

Thanks, Dave 

 

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hi,

From my research and understanding, you'd need to create this record as using the provided methods won't write to that table/field. That is written to by ServiceNow directly.

As using error and error_message doesn't write to the below mentioned table, but just to the error log.

You can use GlideRecord and initialize a new record, supplying the import set information as well as the message for your logging needs.

That table is: sys_import_set_row_error

And variables like: import_set contain the sys_id of the current import set, etc.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Thanks for the ideas, Allen, 

This is going to take some 'playing'. 

 

Dave 

Allen, 

 

There's an even easier way. There's a pre-defined output variable in a Transform Map Script, similar to 'ignore' and 'error' called error_message. 

error_message = "your custom error message";

Works like a charm. Just hard to find it existed. No messing with system import tables, etc. 

 

Dave