GlideImportLog - Scoped, Global
The GlideImportLog API provides methods to write log entries directly to the Import Log [import_log] table.
A GlideImportLog object is consumable by the GlideImportSetTransformer API. This object is not required for the GlideImportSetTransformer API, it enables you to associate import logs with a specific Import Set transformation.
GlideImportLog - GlideImportLog(GlideImportSetRun importSetRun, String source)
Instantiates a GlideImportLog object.
| Name | Type | Description |
|---|---|---|
| importSetRun | GlideImportSetRun | Optional. Import Set Run record on which all logs are to be associated with. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
Example without optional source parameter.
var importSetRun = new GlideImportSetRun();
var importLog = new GlideImportLog(importSetRun);
Example using optional source parameter.
var importSetRun = new GlideImportSetRun();
var importLog = new GlideImportLog(importSetRun, 'Scripted ImportSetTransformer');
GlideImportLog - error(String message, String source)
Logs a message of type Error to the Import Log [import_log] table.
GlideImportLog
| Name | Type | Description |
|---|---|---|
| message | String | Log message. Maximum length 4000 characters. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
| Type | Description |
|---|---|
| None |
var importLog = new GlideImportLog();
importLog.error('Error executing transform');
GlideImportLog - getImportRunHistory()
Returns a sys_id of the Import Run record associated with this Import Log.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| String | Sys_id of an Import Set Run record from the Transform History [sys_import_set_run] table. |
var importSet = new GlideRecord('sys_import_set');
importSet.name = 'Scripted Import Set';
importSet.short_description = 'Import set from scripted rest api';
importSet.table_name = importSetTableName;
var importSetID = importSet.insert();
var importLog = new GlideImportLog();
var transformer = new GlideImportSetTransformer();
transformer.setLogger(importLog);
transformer.transformAllMaps(importSet);
var importRunSysId = importLog.getImportRunHistory();
GlideImportLog - info(String message, String source)
Logs a message of type Info to the Import Log [import_log] table.
GlideImportLog
| Name | Type | Description |
|---|---|---|
| message | String | Log message. Maximum length 4000 characters. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
| Type | Description |
|---|---|
| None |
var importLog = new GlideImportLog();
importLog.info('Successfully executed transform');
GlideImportLog - setImportRunHistory(String importRunHistory)
Associates the GlideImportLog object with a specific Import Set Run record.
| Name | Type | Description |
|---|---|---|
| importRunHistory | String | The sys_id of a record from the Transform History [sys_import_set_run] table. |
| Type | Description |
|---|---|
| void |
var importRunSysId = '4aa3a8d55ba10010953330ad5981c79f';
var importLog = new GlideImportLog();
importLog.setImportRunHistory(importRunSysId);
GlideImportLog - warn(String message, String source)
Logs a message of type Warn to the Import Log [import_log] table.
GlideImportLog
| Name | Type | Description |
|---|---|---|
| message | String | Log message. Maximum length 4000 characters. |
| source | String | Optional. Source field value attached to the Import Log record that defines where in the Import Set process this message was logged from. For example, Loading could represent loading step, Cleanup could represent during the cleanup after the transform, and so on. |
| Type | Description |
|---|---|
| None |
var importLog = new GlideImportLog();
importLog.warn('Transform taking longer than expected.');