Jump to content
The ORIGINAL FileMaker Community - Forum - Online Business Apps & Software Forum
Monkeybreadsoftware

Run scripts via Data API with FileMaker Plugins

Recommended Posts

Monkeybreadsoftware

As you may know the FileMaker Server Data API does not load plugins. If you need to run a script using plugins, you need to use a little trick. You query the application version of the script engine running the script. If you get back "FileMaker Data API Engine 18.0.1", you know the script is run via Data API. Now you can branch to the same script on the server scripting engine. That is a different process on the FileMaker Server which does load plugins. Then you return the result back to the calling script. Let us show you an example script:

If [ Position ( Get(ApplicationVersion) ; "Data API" ; 1 ; 1 ) > 1 ]
    # forward call to Server Scripting Engine
    Perform Script on Server [ Specified: By name ; Get(ScriptName) ; Parameter: Get(ScriptParameter) ; Wait for completion: On ]
    Exit Script [ Text Result: Get(ScriptResult) ]
End If

Exit Script [ Text Result: "MBS: " & MBS("Version") & ", Server: " & Get(ApplicationVersion) ]

As you see we forward parameter and get back the result. So without the trick with the if block, we get back from the script:

"MBS: ?, Server: FileMaker Data API Engine 18.0.1"

and with the if loop and our forward:

"MBS: 10.0.0.9, Server: Server 18.0.1"

And you can use MBS Plugin on the server via Data API.

We recommend to check LastError via Get(LastError) function call after Perform Script on Server to see if you got "Hosts capacity exceeded" with error number 812. In that case it may be good idea to make a 10 second script pause and try again.

PS: See also product idea: Support plugins in Data API

 

from Run scripts via Data API with FileMaker Plugins

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...

Important Information

Terms of Use