IsServer
--------

Checks if plugin is running on a server.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Plugin](component_Plugin.md) | [4.3](newinversion43.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "IsServer" ) ### Parameters

none

### Result

Returns 1 on server or 0 elsewhere.

### Description

Checks if plugin is running on a server.  
So if you see 0 returned, your script or calculation is not performed on a server, but on a client.  
Should return 1 always for scheduled server scripts or web direct scripts.  
  
See also [IsRegistered](IsRegistered.md), [IsClient](IsClient.md) and [IsRuntime](IsRuntime.md).  
### Examples

Run a script on server:

 If \[MBS ("IsServer")\]  
 # We run on server already  
Else  
 # Call this script on server  
 Perform Script on Server \[Wait for completion; “Your Script”; Parameter: Get(ScriptParameter)\]  
 If \[Get(LastError) ≠ 0\]  
 # Can't run on server, e.g. too many connections.  
 End If  
End If  
Perform Script on Server:

 # are we on Server?   
If \[MBS ("IsServer") = 0\]  
 # perform same script on server and pass parameter  
 Perform Script on Server \[Wait for completion; “Do Something on Server”; Parameter: Get ( ScriptParameter )\]  
 # check error and result  
 Set Variable \[$LastError ; Value:Get ( LastError )\]  
 # Maybe handle here error code if server is too busy and decide what to do, e.g. run script locally?  
 If \[$LastError ≠ 0\]  
 # run locally by fall through  
 # alternative: Exit script here and return error to caller  
 Else  
 Set Variable \[$ScriptResult ; Value:Get ( ScriptResult )\]  
 #Return result back to caller  
 Exit Script \[Result: $ScriptResult \]  
 End If  
End If  
\#This now performs on Server or on Client if Server is too busy   
Go to Layout \[“Test”\]  
New Record/Request  
Set Field \[perform::First ; 1\]  
Set Field \[perform::Last ; 2\]  
Commit Records/Requests \[No dialog\]  
\# end of script   
### See also

- [DynaPDF.Initialize](DynaPDFInitialize.md)
- [IsRegistered](IsRegistered.md)
- [JSON.Import.Work](JSONImportWork.md)
- [Plugin.SetFunctions](PluginSetFunctions.md)
- [Register](Register.md)

### Blog Entries

- [Register Script for MBS Plugin](https://www.mbsplugins.de/archive/2022-01-13/Register_Script_for_MBS_Plugin/monkeybreadsoftware_blog_filemaker)
- [Using Apple's Global Service Exchange web service in FileMaker](https://www.mbsplugins.de/archive/2019-09-04/Using_Apples_Global_Service_Ex/monkeybreadsoftware_blog_filemaker)
- [Properly register MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2016-09-15/Properly_register_MBS_FileMake/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.1pr5](https://www.mbsplugins.de/archive/2015-04-14/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin debugging help](https://www.mbsplugins.de/archive/2015-02-27/MBS_FileMaker_Plugin_debugging/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.3pr1](https://www.mbsplugins.de/archive/2014-07-02/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 21st October 2017

  
[IsRuntime](IsRuntime.md) - [IsWindows](IsWindows.md)

[HTML Version](IsServer.shtml)