1 2 Previous Next 18 Replies Latest reply on Jun 26, 2017 12:51 AM by jorber

    Script on server gives error 112

    jorber

      Hi

       

      I am running Web Direct on FMS 16 and have an issue executing script on server as step in a script. When the web client trigger a script to run on server it will return error 112. However, this seems to be depending database. In one database I get the error but not in the other running identical scripts.

       

      What can cause this difference?

        • 1. Re: Script on server gives error 112
          Jens Teich

          My bet on differences in permissions/ security settings.

          • 2. Re: Script on server gives error 112
            jorber

            Yes, this was first thought. However, the scrips are set to run with full access (Revoke Full Access Privileges) but I still get error 112. Are there any other permissions/ security settings to consider?

            • 3. Re: Script on server gives error 112
              coherentkris

              Post the script or the file.

              we are just guessing at this point

              • 4. Re: Script on server gives error 112
                jorber

                When I run identical scripts in identical (?) layouts in two different databases with full access it works in one database but not the other:

                 

                StartScrip

                Perform Script on Server [ “OnServerScript”; Parameter: "To OnServer" ] [ Wait for completion ]

                Set Variable [ $Path; Value:OnServerTest::Path ]

                Set Variable [ $A; Value:Get ( ScriptResult ) ]

                Show Custom Dialog [ Title: "Message from server"; Message: $A; Default Button: “OK”, Commit: “No” ]

                 

                OnServerScript

                Set Error Capture [ On ]

                Go to Layout [ “OnServerTestLayout2” (OnServerTest) ]

                Set Variable [ $Error0; Value:"Error 0: " & Get ( LastError ) ]

                Set Variable [ $Path; Value:Get ( TemporaryPath ) & "test.pdf" ]

                Set Field [ OnServerTest::Path; $Path ]

                Set Variable [ $Error1; Value:"Error 1: " & Get ( LastError ) ]

                Save Records as PDF [ File Name: “$Path”; Current record ] [ Document - ] [ Pages - Number Pages From: 1; Include: All pages ] [ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Page Only; Page Layout: Single Page; Magnification: 100% ] [ Restore; No dialog ]

                Set Variable [ $Error2; Value:"Error 2: " & Get ( LastError ) ]

                Send Mail [ Send via SMTP Server; To: OnServerTest::Email; Subject: "Server sent email"; Message: "File enclosed??" & ¶ & $Error0 & $Error1 & $Error2; Attachment: “$Path”; Name: "BioMS"; Email Address: "info@bioms.se"; SMTP Server: "smtp.gu.se"; Port: 25; Authentication Type: None ] [ No dialog ]

                Set Variable [ $Error3; Value:"Error 3: " & Get ( LastError ) ]

                Set Variable [ $M; Value:$FromWebClient & ¶ & $Path & ¶ & $ErrorStart & $ErrorLayout & $Error0 & ", " & $Error1 & ", " & $Error2 & ", " & $Error3 ]

                Exit Script [ Result: $M ]

                • 5. Re: Script on server gives error 112
                  philipHPG

                  Are there any script triggers involved: OnFirstWindowOpen, OnWindowOpen, or OnLayoutEnter for OnServerTestLayout2 (or even an OnLayoutExit for your default layout)?

                  • 6. Re: Script on server gives error 112
                    coherentkris

                    i dont see where $FromWebClient, $ErrorStart or $ErrorLayout are being set in your script.

                    probably wont cause failure tho...

                    What shows in the custom dialog at the end of the first script?

                    Is that where you are picking up the 112 code?

                    if yes which step is actually throwing it.

                    I think philmodjunk is on the right track with triggers....

                    • 7. Re: Script on server gives error 112
                      jorber

                      No script triggers  for involved layouts.

                      • 8. Re: Script on server gives error 112
                        jorber

                        Sorry, the variables was removed from the script as they did not give any answers. I forgot to remove them from the dialog. The $FromWebClient was used to pick up script parameter sent from StartScript to OnServerScript to see if the script was executed at all on the server. This line was removed from this version as the script was not triggered.

                        • 9. Re: Script on server gives error 112
                          coherentkris

                          As i asked in my post.. what step is actually throwing the error 112?

                          You have 4 possible error variables that could be picking it up... which one is capturing it?

                          I'll bet that its getting picked up by $error0 that means the Go To Layout script step is throwing it.

                           

                          Good that there is no layout level triggers firing but what about any file or window level triggers?

                           

                          From Soliant...

                          The 5 file-level triggers are:

                          • OnFirstWindowOpen, OnWindowOpen
                          • OnWindowClose, OnLastWindowClose
                          • OnFileAVPlayerChange

                           

                          As Wim and others herein have suggested you should scour your solution for triggers that could be messing things up.

                           

                          In addition to the other suggestions stepping through the script with debugger on and watch the call stack to see what is firing when from the time you open the file till the time the scripts you wrote are finished.

                          • 10. Re: Script on server gives error 112
                            wimdecorte

                            Since error 112 has to do with windows, work backwards from any script step in your solution that manipulates windows (use the DDR for this).  Focus on things that close windows or move windows.  When you find the scripts that do, figure out where they are being called from.  Chances are you'll find some trigger somewhere.

                             

                            Also, look at all your scripts with the webdirect compatibility toggle on, to make sure they don't report anything that you dont' expect.  Some will say 'virtual window' etc, read through the scripts carefully.

                            • 11. Re: Script on server gives error 112
                              jorber

                              I have now found out that it is something in the startup and login scrips in the large database that causes this issue. I will spend the midsummer (among with some other things) to try to isolate the problem…

                               

                              I will get back to this thread when I hopefully have the answer.

                              • 12. Re: Script on server gives error 112
                                jorber

                                I have found the script step that causes the problem but I really do not understand why: The script step is not executed in a web browser on a computer!

                                The script steps are:

                                 

                                #Check if device is a smartphone or have a low resolution screen
                                Set Variable [ $$ScreenSize; Value:Get ( ScreenWidth ) * Get ( ScreenHeight ) ]
                                If [ $$ScreenSize < 600000 ]
                                     Show Custom Dialog [ Title: "Error"; Message: "Your screen resolution is not supprted!"; Default Button: “OK”, Commit: “No” ]
                                     Exit Application
                                End If

                                One of those script steps prevent the script ScriptOnServer, mentioned above, to be triggered later! If I deactivate Exit Application the issue disappear. If I replace Exit Application with Close Window [ Current Window ] the issue still remains.

                                 

                                Can anyone explain to me why a script step that is not even executed can cause this issue on FileMakerServer for both web browser clients and FileMaker Pro clients?

                                • 13. Re: Script on server gives error 112
                                  coherentkris

                                  What makes you think your steps are not executed in a web browser?

                                  Did you mean that the explicit call to Exit Application?

                                  Servers usually dont have screens.

                                  When i run a PSOS on my server that returns Get (ScreenWidth ) * Get(ScreenHeight) it returns 307200 which, in your script would cause the dialog ( illegal in PSOS) and Exit application every time.

                                   

                                  If this is in fact the proximate cause then the fix can be to wrap the entire statement in an if statement that checks to see if its running under the servers account and if true do not execute any of the steps..

                                  i.e.

                                  if ( server account ) then

                                  // do nothing

                                  else

                                       #Check if device is a smartphone or have a low resolution screen

                                       Set Variable [ $$ScreenSize; Value:Get ( ScreenWidth ) * Get ( ScreenHeight ) ]

                                       If [ $$ScreenSize < 600000 ]

                                            Show Custom Dialog [ Title: "Error"; Message: "Your screen resolution is not supprted!"; Default Button: “OK”, Commit: “No” ]

                                            Exit Application

                                       End If

                                  End if

                                  • 14. Re: Script on server gives error 112
                                    jorber

                                    The reason I think that these steps are not executed on the server is that the web browser client does not get the dialog window as for other steps in the start script and that the resulting $$ScreenSize > 600000 in my web browser. Note that this start script does note give any errors. It is later when the script OnServerScript is to be executed on server the issue occurs if the Exit Application is included in the start script.

                                    1 2 Previous Next