Perform Script On Server
Purpose 
Performs a script on the server that is hosting the current file.
Format 
Perform Script On Server [Wait for completion; "<script name>"; Parameter: <parameter>]
Options 
 •
To select a script, click Specify and choose the script from the list.
For Optional script parameter, type the text you want to use or click Edit and use the Specify Calculation dialog box to build a more complex parameter.
 •
Wait for completion pauses the script on the client until the sub-script called by Perform Script On Server is completed on the host. 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.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server scheduled script 
No 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
No 
Originated in 
FileMaker Pro 13.0
Description 
The current file must be hosted on FileMaker Server. Otherwise, Perform Script On Server returns an error. Scripts performed on the host are treated as FileMaker Server scheduled scripts.
Scripts performed by Perform Script On Server:
 •
 •
 •
Note  If records are locked by a client, scripts performed on the host cannot access uncommitted data or change the contents of those records.
Example 1 
Runs a script on the server and sends the current layout name, record number, and customer email address as the script parameter. The server navigates to the layout and record specified in the parameter, saves a snapshot link of the current record, emails the snapshot link to the email address specified in the parameter, and returns a result. The client fetches the script result from the server and displays it in a custom dialog.
Main script: Email snapshot link (Client)
Perform Script On Server [Wait for completion; "Email snapshot link (Server)"; Parameter: List ( Get ( LayoutName ) ; Get ( RecordNumber ) ; Customers::Email )]
Show Custom Dialog [Get ( ScriptResult )]
Sub-script: Email snapshot link (Server)
Go to Layout [MiddleValues ( Get ( ScriptParameter ) ; 1 ; 1 )]
Go to Record/Request/Page [MiddleValues ( Get ( ScriptParameter ) ; 2 ; 1 )]
Set Variable [$PATH; Value:Get ( TemporaryPath ) & "Snapshot.fmpsl"]
Save Records as Snapshot Link ["$PATH"; Current record]
Send Mail [Send via SMTP Server; No dialog; To: MiddleValues ( Get ( ScriptParameter ) ; 3 ; 1 ); "$PATH"]
Exit Script [Result: "Snapshot link sent."]
Related topics 
Perform Script script step
Perform Script and script parameter examples
Script steps reference (alphabetical list)
Script steps reference (category list)