Perform Script on Server

Perform Script on Server is the one step which will change how you develop FileMaker solutions FOREVER. Yes, I said that with all caps! This is exciting!

There's so much power in how it can be used, that it truly is a game changer. This is fundamentally why the web is so popular. It works like this.

Your client, a web browser, makes a request to some beefy server and it wrangles the data and then reports back with the compiled results. This is essentially what this new script step does, but with all the power of what FileMaker can do.

Until you start using it, it "seems" like it's just "another feature". Changing the way you think about FileMaker development, using PSoS for short, is inevitable. If your solutions are stuck in versions prior to 13, then you might want to beg, borrow or steal (ok, not steal) to start using this feature.

With PSoS, you can import hundreds of thousands of records in mere seconds. You can send hundreds of thousands of emails without ever seeing a spinning waiting indicator. You can update hundreds of thousands of records with lightning speed or generate a hundred page report as a PDF within minutes instead of hours.

This video provides all the critical know-how in order to start working with PSoS and it will get you going fast!

AttachmentSize
Plugins.fmp12.zip212.1 KB

Comments

This issue occurs attempting to install ScriptMaster 4.206 from within the example file, or trying to enable the plug-in that was installed manually into the Server's Extensions folder (and blessed for correct permission with Terminal). Experimenting with the number of maximum simultaneous script sessions (from default of 20 up to 200) has not changed the error behavior.

Error number 812: "The host's capacity was exceeded, try again later." requires that I restart FMSE from within Terminal.

This is a completely fresh TEST server (mac Mini quad-core), with default Mavericks 10.9.x install (not OSX Server), FMS 13.0 updated to 13.0v1.

Any idea on how I can get ScriptMaster to enable?

Thanks in advance,
Scott

I have come across similar issues and I don't know what the reproducible steps are. FileMaker Server is probably very permissions sensitive - as is the case with most daemons.

You mention the plugin was "installed manually" and if it was copied then you need to check the permissions and ownership on it. You may not be able to update it if it isn't owned by the fmserver:fmsadmin user and group.

Within the Terminal you would check this by using the following commands (this is for Mac - Windows would be different)

cd /Library/FileMaker\ Server/Database\ Server/Extensions
ls -lhaR

Now scan the listings to make sure everything is fmserver:fmsadmin

For any you find which are not set with the fmserver owner and fmsadmin group then you'll needed to change them with chmod (run 'man chmod' for more info)

You'll then want to restart the database server and possibly the script engine.

sudo fmsadmin restart server

Will restart the server. Getting the "host's capacity" message is something that has happened to me when installing plugins some times. The only solution I know of is restarting things. But once it's working, it works - at least that's my experience.

-- Matt Petrowsky - ISO FileMaker Magazine Editor

Thanks for the prompt reply. I followed the authoritative FMS13 help section on…"Changing plug-in file permissions (OS X)", but it did not help. In the 360Works forum for SM4 on fmForums, someone spoke of installing Java 6, but this just should not be. I do think it has something to do with Java though, as the Base Elements plug-in install went without a hitch.
==========================
To change plug-in file permissions:
1. Start the Terminal application and use the cd command to set your path as needed.
2. Enter the following at the command line:
chmod g+rx
or
chmod g+wrx
The g+rx is necessary because plug-ins and system-level scripts must have the group read and executable bits enabled. Use the g+wrx form to permit write permission as well. Some plug-ins or scripts that use preferences or folders of additional files may require write permission to those files or folders.

Dear Matt,
I came across your reply and it refers to a situation that is driving me N U T S (!):

I want to call the smtp_send function via a psos script step.

For debugging reasons the script has a very limited functionality:
1. set the variables for the smtp mail (all hard coded text variables)
2. BE smtp server
3. BE smtp send

When I run this script on my local machine (mac) it performs as expected, however, when I call this script via the psos script step I get the message:
"The host's capacity was exceeded, try again later." *arrrrrgggghhhh*

I have BEplugin (4.0.2) installed on FMCloud and on my local machine.
All other BE functions (I have tried) work fine with the psos script step.
Software is up to date and the latest updates are installed.
After the installation of the plugin the fm cloud instance has been refreshed the AWS instance rebooted.

Do you have any idea, how I could resolve this?
Any help would be deeply appreciated (again).

Gerfried (alias Max Quest)

Well, I opened your plug-ins file on the server with FileMaker Pro Advanced 13, then chose to install the ScriptMaster plug-in locally, which then opened the old APple Software Update and stated it needed to install Java 6, which I did.

I then turned off, then on the Server via Admin Console, then opened your example plug-ins file, and it installed ScriptMaster this time.

Here's a link to the article I found that led me to think this way…
http://fmforums.com/forum/topic/90471-scriptmaster-360-works-filemaker-s...

This would make sense. ScriptMaster is looking for java in the default OS path for java. FileMaker's own install of java is probably running independent of the OS install of Java.

If you install Java 7 from Oracle, then there may (or may not - I forget) be some magic command line incantations to set the path to use version 7 instead of 6.

The server I'm running off, for production, is Windows and it has Java installed. On my laptop dev server, where I shot the video, I have Java 7 JDK installed http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1... so that's why I didn't hit the issue.

Thanks for the find!

This will help someone else out who wants to use ScriptMaster on server side with a Mac without Java installed for OS use.

Get ready for the real super power OH MY!

-- Matt Petrowsky - ISO FileMaker Magazine Editor

For the super technically inclined...

This might help anyone out who wants to determine where java is being run from on a Mac server.

ps aux | grep java

Will show you the binary and the commands used to run java apps.

ls /usr/bin | grep java

Will show you which java install is being used. You have to follow the trail of symlinks.

On the command line you can determine which version of java is used there... using...

java -version

But the way to see what ScriptMaster uses is by looking at the contents of

head ~/Library/Logs/360Plugin\ Logs/360Plugins_FMAdvanced.log

In most cases, ScriptMaster is using Java 6 despite 7 being installed. This is where you would need to adjust the path if you wanted ScriptMaster to use Java 7.

-- Matt Petrowsky - ISO FileMaker Magazine Editor

Matt, even when logged in as member, the file Plugins.fmp12.zip refuses to download and gives a No Access message

Peter Sijmons
Szienz
Netherlands

Wait for completion must be selected to pass a script result or error code from the host to the client. Use the Get(ScriptResult) function to capture a result or the Get(LastError) function to capture an error code.

If it is left unchecked and I still want to error check or get the script result without waiting, would the best option be to have the script (script within the script) get(lasterror) and SetField to a (utility) field somewhere?

If you don't wait for completion then you'll need to implement an error capture and logging system.

We have one here http://filemakerstandards.org/pages/viewpage.action?pageId=4161538 and you'll also find resource here.

http://www.modularfilemaker.org/2013/11/errorhandling/

-- Matt Petrowsky - ISO FileMaker Magazine Editor

HI Matt,
What about when using a separation model. Can PSOS be used. Currently I just use perform script in the client and find a script on the data file being served. Then get result. But I don't think this is processing on the server??
What do think?

Thanks,

CJ

There is a bug with Perform Script on Server where it will not pass authentication information to another file which is linked via EDS (external data source). The only solution around this is to call the script from within the file where it exists.

-- Matt Petrowsky - ISO FileMaker Magazine Editor

Was that a bug with PSoS in TSM solutions using an external data source hosted on the server, or with solutions that reference External SQL source data? If the former, I take it that I would call the PSoS script on the hosted file, which is the wrapper for the actual script to be performed by the server, si that correct?

Thanks in advance,
- - Scott

I fixed my comment. It's not external sql source its a related external filemaker file where the script cannot be called from the original file where PSoS was started.

-- Matt Petrowsky - ISO FileMaker Magazine Editor