I’ve been experimenting with the postimport module.
I’ve added a simple function to add a couple of records in a table:
function addRecords(){
application.output('- - Starting add records');
var fs = datasources.db.ccs.sec_key.getFoundSet();
var rec = fs.getRecord(fs.newRecord());
rec.key_id = 25;
rec.name = 'Advanced Reports (View)';
rec.sort_order = 307;
databaseManager.saveData(rec);
application.output('- - key 1 added');
rec = fs.getRecord(fs.newRecord());
rec.key_id = 26;
rec.name = 'Dashboard Settings';
rec.sort_order = 212;
databaseManager.saveData(rec);
application.output('- - key 2 added');
}
When I import the solution on the server than I can see the output messages in the browser, but the records are not in the database.
In another function I update a record in the database (setting new version number at the end of the import module) like this:
function setDatabaseVersion(newVersion) {
var fs = datasources.db.ccs.feedback_properties.getFoundSet();
fs.find();
fs.feedback_property_id = "79F75FEF-DBA7-4FDE-9792-62DDE584618D";
if(fs.search() === 1){
fs.property_value = newVersion;
databaseManager.saveData(fs);
}
}
And this update is correctly in the database.
Is there any reason why my new records don’t show up in the table?