This class provides methods that allow importing data from external parties.
SimpleImport()
Instantiates a new empty SimpleImport class object.
Example:
SimpleImport
let imp = new SimpleImport();
getErrorMessage()
This method returns the current error message.
Return:
Type
Description
String
The error message text
getErrorMessage
import(record, testMode)
The method takes the record from the sys_import_source tables and imports the entries from the attachment to the table created via the import_set_table_name field of the sys_import_source table. As a result, we get a table with temporary records - an Importset, from which the records import to any other table will be performed.
The record parameter must be the record from the sys_import_source table.
The testmode parameter is a Boolean parameter. If its value is TRUE, then it will perform the test import and indicate operation status as "test".
Parameter(s):
Name
Type
Mandatory
Default Value
record
SimpleRecord
Y
N
testMode
Boolean
N
FALSE
Return:
Type
Description
Void
This method does not return a value.
Example:
import
var imp = new SimpleImport();
imp.import(current);
importTransform(record)
This method is used for the automatic scheduled import.
The record parameter must be the record from the sys_schedule_import table.
Method gets the record from the sys_schedule_import table and performs import and transform in one time.
Parameter(s):
Name
Type
Mandatory
Default Value
record
SimpleRecord
Y
N
Return:
Type
Description
Void
This method does not return a value.
Example:
importTransform
var imp = new SimpleImport();
imp.importTransform(current);
testLdapConnection(record)
Therecordparameter must be the record from the sys_ldap_server or sys_ldap_definitiontables.
This method checks the connection to the LDAP server and alerts about the successful connection, or about an error.
Parameter(s):
Name
Type
Mandatory
Default Value
record
SimpleRecord
Y
N
Return:
Type
Description
Array
Returns array containing description of connection status.
Example:
testLdapConnection
var imp = new SimpleImport();
var result = imp.testLdapConnection(current);
if (result.flash.type === "success") {
ss.addInfoMessage(result.flash.message);
}
if (result.flash.type === "error") {
ss.addErrorMessage(result.flash.message);
}
transform(record)
This method transposes entries from the import set to the table. It uses the active transform map, which is located in the sys_map_transform table.
source - the current import set table;
target - the destination import set table.
The record parameter must be the entry from the sys_import_set table.
A transform map is a set of field maps that determine the relationships between fields in an import set and fields in an existing table.
Parameter(s):
Name
Type
Mandatory
Default Value
record
SimpleRecord
Y
N
Return:
Type
Description
Void
This method does not return a value.
Example:
transform
var imp = new SimpleImport();
imp.transform(current);