Import Before Run
Sometimes there’s the need to import files with complex data types, or to avoid creating duplicates, etc., for all these needs the code section is essential, there are 4 main coding section, plus one for each entity field.
The scripting area “Before Run” is were to put Custom PHP code that has to be executed before import procedure starts.
It is commonly used to retrieve records from the DataBase and to put those records inside an Array, in order to avoid multiple select queries on the DB.
Typically, data retrieved are the same model of the import. But we can use this scripting area also to pre-load related models. For example, if we are importing CMDB CI records, we could pre-load a collection of CMDB Types and CMDB Subtypes inside this scripting areas.
The collections are typically stored inside variables, that are available also inside the other scripting areas.
Attention: if you use the same name of a PHP variable, it will be overwritten.