7 Replies Latest reply on Aug 24, 2016 2:22 PM by TSGal

    Modal FileMaker Window prevents PSOS script from changing data

    philmodjunk

      Summary

      Modal FileMaker Window prevents PSOS script from changing data

      Product

      FileMaker Pro

      Version

      FMP 13 and FM Server 13

      Operating system version

      Windows 7 and Windows Server

      Description of the issue

      I have two files: file 1 and file 2. I used Go To Related Records to open a new modal window in file 1 from a script in file 2.
      I then tried to perform a script from the context of this modal window. It's a one line script:

      Perform Script On Server ["script name" from file: "file 2" ; Parameter: Get ( ScriptParameter ) ]

      This script fails with the message that this cannot be done from a modal window. If this were Perform Script, that would make sense as I am attempting to modify a record open in another window and file.

      But this doesn't seem like something that should fail when performing a server side script...

      Configuration information

      The modal window is the 3rd window of file 1 open at the time this script is performed. Script is performed from an OnObjectModify trigger on a radio button field. Parameter passed is a list of the field's value, the ID of the current record and the ID of the record to be modified in File 2.

      Workaround

      Script works when I perform it from a non modal window on the same layout and record. But I need that window to be modal...

      I guess I could set a global variable to the parameter values and perform the script after the window is closed, but what a major Kludge just to get around this issue!

        • 1. Re: Modal FileMaker Window prevents PSOS script from changing data
          philmodjunk

          Ok Figured out my own work around.

          Use PSOS to perform a script in the same file as the modal window. Have that PSOS performed script do a regular perform script to perform the script in the other file.

          That means that script trigger passes list of parameters to script 1. Script 1 passes list of parameters to script 2 in a PSOS call and then Script 2 passes list of script parameters on to Script 3 in File 2 via a Perform Script Call.

          I'd call that a Kludge, but one that I can live with.

          • 2. Re: Modal FileMaker Window prevents PSOS script from changing data
            philmodjunk

            My research on this continues and I've also found out the hard way that a script performed via PSOS cannot open a file not already open by the client. That seems a very strange requirement given:

            a) This is supposed to be a "server side" script yet which files are open client side make a difference

            b) In other parts of FileMaker, when a reference to file2 is encountered in File1, the credentials used to open file1 are then used in an attempt to open file2 and an error occurs only if their is no account with matching credentials in file2. Don't see why this tried and true method for opening other files can't also be used here and it's absence raises what appears to me to be a needless roadblock.

            That then documents two rather silly limitations in the current design:

            A script run from a modal window can't modify data in another window/file. (It makes sense to keep users from doing this, it's a modal window after all, but why prevent a script from being able to do this?)

            A script performed by Perform Script On Server can't open another hosted file. Again, we have a tried and true method for controlling what files can or can't be used and we use that method to open the first file in the server session so why not use this approach for other files in the server session?

            And that still leaves what I see as either a bug or a rather inconsistent design feature:

            A trigger/button in a modal window can be used to do a PSOS to run a script in another file, but it can be used to PSOS a script in the same file--which can then be used to perform a script in the other file. Why make us jump through an extra hoop and spend a lot of unnecessary time documenting the chain of scripts so that I and my fellow developers can understand why the added complexity was needed just to change a field in another file?

            Fortunately for my current project, I figured out that I was only opening the modal window for File1 from a script in File2. Thus, I always have both windows open. The only time this was not the case, was when I ran the script from a non modal window with a different name so I just modified the script to check the current window name and use PSOS when it was the name of the modal window and to use perform script when it was not. But I may not be so lucky next time...

            • 3. Re: Modal FileMaker Window prevents PSOS script from changing data
              TSGal

              PhilModJunk:

              Thank you for your posts.

              This information was entered by our Documentation manager on May 7 so this gets documented better in future documentation.  There was a comment entered by one of the developers on July 25:

              Perform Script On Server script step can only open files hosted on the same server, and can only open files that are already open by the client who started the Perform Script On Server.  The latter part is required, since doing anything else would open a security hole.

              TSGal
              FileMaker, Inc.

              • 4. Re: Modal FileMaker Window prevents PSOS script from changing data
                philmodjunk

                It's the "security hole" comment that has me scratching my head. I can already use file 1 to open file 2 if the credentials match, so I'm having trouble imagining what security hole this opens that doesn't already exist for a FileMaker system...

                • 5. Re: Modal FileMaker Window prevents PSOS script from changing data
                  TSGal

                  PhilModJunk:

                  One of the developers replied:

                  The client can use file 1 to open file 2 because the client application has the credentials the user entered.  Perform Script On Server must not have the original credentials, since security requires that only the client's one-way-hashed credentials are ever sent over the network.

                  TSGal
                  FileMaker, Inc.

                   

                  1 of 1 people found this helpful
                  • 6. Re: Modal FileMaker Window prevents PSOS script from changing data
                    databuzz

                    Just wondering if there are limitations to using PSOS when the script that is running is in a modal window? I'm having problems calling a PSOS step (getting error 3 - the PSOS doesn't actually execute). I've got another discussion going over here:

                     

                    Perform Script on Server Returns Error 3

                     

                    but stumped across this - didn't realise the modal window was an issue with PSOS. Is there any documentation about the limits of PSOS, for example when calling a script in an external file (even though the file is already open)?

                     

                    Thanks

                    1 of 1 people found this helpful
                    • 7. Re: Modal FileMaker Window prevents PSOS script from changing data
                      TSGal

                      databuzz:

                       

                      Please see the FileMaker Pro 15 Help topic "About window styles":

                      FileMaker Pro 15 Help

                       

                      The section "Dialog window" discusses the limitations.  "Users must close all open dialog windows before they can open a new file or run scripts from the Scripts menu."  The table that accompanies the supported script steps for a Dialog window shows Perform Script "Will fail if executed from another open file".

                       

                      TSGal

                      FileMaker, Inc.