12 Replies Latest reply on Jul 16, 2014 2:07 PM by PaulWebb

    Error number not capture for no record found

    PaulWebb

      The below script is my OnOpen script. This has worked in the past with no problems. The only recent changes have been patches to the server (FMS13). I have installed all available patches.

       

      The problem is with the find (enlarged font below). Walking through the script it enters find mode and then sets the user field to the appropriate value. The perform find pops an error stating no records match the find criteria. Clicking continue moves on to the IF statement but no error has been captured and it bypasses the IF statement. Any ideas as to what might be wrong?

       

      If [ LeftWords ( Get ( AccountName ) ; 1 ) = "z" ] 
      
      Halt Script 
      End If 
      # 
      Perform Script [ “Allow User Abort” ]
       Perform Script [ “Set Error Capture” ]
       #
       Set Variable [ $$FileName; Value:Get ( FileName ) ]
       Set Variable [ $$AccountName; Value:Get ( AccountName ) ] 
      
      Set Variable [ $$Verify; Value:0 ] 
      #
       # Place the window at the top center of the screen.
       Move/Resize Window [ Current Window; Top: 0; Left: ( Get ( WindowDesktopWidth ) / 2 ) - ( Get ( WindowWidth ) / 2 ) ] 
      
      Freeze Window
       If [ Get ( AccountPrivilegeSetName ) = "[Full Access]" ] 
      Go to Layout [ “Administrator” (GLO) ] 
      
      Else 
      If [ PatternCount ( Get ( ApplicationVersion ) ; 13 ) < 1 ] 
      
      Go to Layout [ “Version_Check” (GLO) ] 
      Else 
      # Perform startup scripts. 
      Perform Script [ “Allow Toolbars” ]
       Perform Script [ “Lock | Zoom | Hide” ]
       // Perform Script [ “Install Menu Set” ]
       # Log user access.
       New Record/Request
       # Create STAFF record if none exists for current account. 
      
      Go to Layout [ “STF_Form” (STF) ]
       Enter Find Mode [ ]
       Set Field [ STF::zct_UserID; "==" & Get ( AccountName ) ] 
      
      Perform Find [ ]
       If [ Get ( LastError ) = 401 ] 
      New Record/Request 
      Show Custom Dialog [ Title: "My Profile"; Message: "Complete your profile and add your portfolios before moving on."; Default Button: “OK”, Commit: “Yes” ] 
      
      End If 
      Show All Records 
      
      End If