Finding the Primary Key

Is there a way to get the primary key of a table? I’ve tried this

forms[myForm'].foundset[databaseManager.getTable('db:/dbName/tableName')]

I had this working at one time as far as I can remember but for some reason it is not doing it now. I keep getting “Undefined”.

CFDaddy:

forms[myForm'].foundset[databaseManager.getTable('db:/dbName/tableName')]

That returns foundset-dot-table_object. Just need the table object. Several ways to do it:

//whats the name of the pk
var jsTable = databaseManager.getTable(foundset.getDataSource()) // or databaseManager.getTable('db:/dbName/tableName')
if (jsTable) {
	//assumes only 1 pk
	var pkName = jsTable.getRowIdentifierColumnNames()[0]
}