Don't use record number, use the primary key for the related records.
OTOH forget this method entirely and use a popover to display the data.
As Vaughan suggests, if you are using a newish version you can use a popover to display additional or related data.
However, if you need really is to go to a record from the portal on its own layout, then your script should have as one of its first steps:
Set Variable [ $thisRecord ; Value: <the portal record's primary key> ]
You can then use this variable within a Find script segment:
Enter Find Mode [ ]
Set Field [ <primary key field in the related table>; $thisRecord ]
Perform Find [ ]
If you want to bring up the record on its own layout, use Go To Related Record. You can do it all in one script step.
All fantastic suggestions. I will update which worked best for me when I