FileMaker 16 has been out for several months, however we wanted to call attention to a change that can effect your application’s use of server side scripting. Recently, we upgraded a client project to FileMaker Server 16, and found that critical functionality had mysteriously broken. After a bit of sleuthing and gnashing of teeth, we found that changes to the output of
Get(SystemDrive), when executed server-side (PSOS or via a scheduled script), was the culprit.
As of FileMaker Server 16, in order to increase security of the platform, four functions that output paths no longer return any value when executed via a server-side scripts. These are:
Get(FileMakerPath). Note that the documentation for these functions does not consistently mention that the they are no longer supported for server-side scripting. This thread in the FileMaker community forum addresses this and indicates that the documentation should be updated in a future release. Unsurprisingly, these functions also don’t return a value if using a WebDirect client.
Option A – Get(DocumentsPath)
Fortunately, a simple solution is available. Turns out the
Get(DocumentsPath) still returns a value when executed on server, and so can be leveraged in a calculation or custom function:
Let ([ path = Get ( DocumentsPath ) ; driveEnd = Position ( path ; "/" ; 1 ; 2 ) ; systemDrive = Left ( path ; driveEnd ) ]; systemDrive )
Hopefully this will be a permanent solution. There may be some risk to this approach if a future version of FileMaker Server changes the output value of
Get(DocumentsPath). Fingers crossed!
Option B – AppleScript with bBox
We have another solution courtesy of Beezwax’s very own Simon Brown. Turns out there is also an AppleScript option if your system is hosted on a Mac server. This option requires the bBox FileMaker plugin. You can use the
bBox_Applescript function to return the system drive:
Let ([ drive = bBox_Applescript( ""; "path to startup disk as string" ) ; // returns "Macintosh HD:" (including quotes!) systemDrive = "/" & Middle ( drive ; 3 ; Length ( drive ) - 4 ) & "/" // returns /Macintosh HD/ ]; systemDrive )
Finally, users of the EmailPro module should upgrade as it has a dependency on