getting newly created autoincrement record id

I have a form set up that is for entereing new information about a person.
I’m using Mysql autoincrement for the pk and transactions.
I want to change the selected record to the newly created one in the main form.
I can’t seem to get the record id.

I’ve tried committing the change and placing the record_id in a global, but i never get what I’m after..

Any help?

Thanks

Try this:

controller.newRecord(true)
controller.saveData()
var x = idField //x contains the new ID

Setting the flag true on the record creation will place the new record at the top of the foundset.