Is this what you mean? You want to capture the ID of the current layout record's ID and also the ID of the portal row record that has the current focus?
If so, two set variable steps can capture these values into two different variables as a result of clicking a button in the portal row.
I want to capture the ID of the current layout record ID and the ID of the record the portal row is displaying. I have a button there that runs my "move record" script, but I don't know the syntax to capture the variables. I want to use those variables to go into the join table and delete the appropriate record to complete the move so it no longer is part of the original cluster record.
At the beginning of your script (before layout or other changes lose the portal row focus)
Set Variable [$ParentID ; LayoutTableOccurrence::PrimaryKey ]
Set Variable [$ChildID ; PortalTableOccurrence::Key ]
Awesome. Got my script to work perfectly now.