The web viewer resets if you use Freeze Window?
You can set up a relationship between a field in the layout's table and the portal's that matches that field to the portal's error code field. Your script can then set this field to the script parameter and check to see if it matches to any record in the portal's table.
LayoutTableOccurrence::SelectedErrorCode = PortalTable|Errorcode::ErrorCode
Set Field [LayoutTableOccurrence::SelectedErrorCode ; Get ( ScriptParameter ) ]
If [ Not IsEmpty ( PortalTable|ErrorCode::ErrorCode ) // error code exists in portal's table ]
Replace "LayoutTableOccurrence" with the name shown in Layout Setup | Show Records from for your layout. Replace PortalTable|Errorcode with the name of a new Tutorial: What are Table Occurrences? of the portal's table that matches by Errocode.
Freeze window did not work. I found a way to not having a reset being an issue, but your suggestion is great. Will save it. Thanks!