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.
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...
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.
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...
1 of 1 people found this helpful
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.
1 of 1 people found this helpful
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:
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)?
Please see the FileMaker Pro 15 Help topic "About window styles":
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".