Look it up using manage | database?
There is no method other than using a rigorous naming convention to reference the PK as there is no such thing as a "primary key" field option, it's only in how we choose to define and use a field that makes it a PK.
So if you named all PK's after this convention:
"__pk" & Get ( LayoutTableName ) & "ID"
would return the name of the field.
Let ( TO = Get ( LayoutTableName ) ;
GetField ( TO & "::" & "__pk" & Get ( LayoutTableName ) & "ID" )
) // Let
Would return the value of the current record's primary key, but only if the current layout's TO is named in accordance with that specific naming convention.
exactly what ai was looking for
Note however, that this is an example of what I call "brittle design". You do gain some code flexibility in that you are using indirect field references, but by including portions of the field and/or table occurrence name in quotes, you have also created a design where renaming a field or table occurrence causes this calculated reference to fail. No warning messages will appear about this calculated reference if you or another developer later renames the TO or field either.
So there are both pros and cons to this approach.