- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 05:25 PM
Hello,
I am able to log custom errors during the import process but, somehow I cannot associated them with the import set.
Here is code similar to what I am using.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var importSetRun = new GlideImportSetRun();
var importLog = new GlideImportLog(importSetRun, 'My Source');
if (<condition>) {
return string;
} else {
ignore = true;
importLog.error( "Custom error log here");
}
})(source)
What am I missing in order t o associate this log to the import set so I can easily see the errors by simply navigating to the import log related list of the import set?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 06:23 PM
You can just use the 'log' variable that is up in the runTransformScript function.
Generally the GlideImportLog API would be used when you are starting an import from a script outside of an import set.
See Transformation script variables for more info on the other variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 06:56 AM
Hi BP,
When using the log.error that is part of the function it does not log anything at all, using the GlideImportLog does log errors but I would like to know how to associate it with the import set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 12:01 PM - edited 08-14-2023 12:04 PM
Found the solution. While copying an pasting from other transform scripts I did not pay attention to the last line of the script which was missing parameters. The code bellow works. Turns out I did not have to use the GlideImportSetRun().
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if (<condition>) {
return string;
} else {
ignore = true;
log.error( "Custom error log here");
}
})(source, map, log, target)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 06:23 PM
You can just use the 'log' variable that is up in the runTransformScript function.
Generally the GlideImportLog API would be used when you are starting an import from a script outside of an import set.
See Transformation script variables for more info on the other variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 06:56 AM
Hi BP,
When using the log.error that is part of the function it does not log anything at all, using the GlideImportLog does log errors but I would like to know how to associate it with the import set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 12:01 PM - edited 08-14-2023 12:04 PM
Found the solution. While copying an pasting from other transform scripts I did not pay attention to the last line of the script which was missing parameters. The code bellow works. Turns out I did not have to use the GlideImportSetRun().
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if (<condition>) {
return string;
} else {
ignore = true;
log.error( "Custom error log here");
}
})(source, map, log, target)