key from new record

Why does a foundset not return the key of a new record?

FS.newRecord( );
FS.value1= "some value";
FS.value2=  "some other value";
FS.value3=  "another value";
databaseManager.saveData( FS );

CFS.FK= FS.id;

So I want to save the key of the new record in FS in a FK column in CFS. But FS.id is empty after the saveData. Why does it lose it’s record after saving and why does it not automatically return the primary key after making a new record?
How can I get the id of FS easily and reliably to store in CFS?

Hi
try doing a refresh of records from foundset and then get record one

databaseManager.refreshRecordFromDatabase(FS, 1);
var rec = FS.getRecord(1) ;
CFS.FK= rec.id;

Rafi

Or try this:

var rec = FS.getRecord(FS.newRecord());
rec.value1= "some value";
rec.value2=  "some other value";
rec.value3=  "another value";
databaseManager.saveData(rec);

CFS.FK= rec.id;