JavaScript.CallFunction
-----------------------

Calls a global function given the name with FileMaker values.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [JavaScriptWebKit](component_JavaScriptWebKit.md) | [12.2](newinversion122.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "JavaScript.CallFunction"; JavaScriptContext; Name; Parameters... ) 

**MBS**( **"JavaScript.CallFunction";** /\* Calls a global function given the name with FileMaker values. \*/  
**$JavaScriptContext**; /\* The reference number of the javascript context.e.g. $Context \*/   
**$Name**; /\* The name of the function.e.g. "test" \*/   
**$Parameters...**) /\* Value to pass as parameter. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JavaScriptContext | The reference number of the javascript context. | $Context |
| Name | The name of the function. | "test" |
| Parameters... | Value to pass as parameter. |  |

### Result

Returns value or error.

### Description

Calls a global function given the name with FileMaker values.  
Parameters are passed to the function. Please pass as many parameters in FileMaker as needed.  
Numbers are passed as number and other values are passed as text.  
If the function needs more parameter, undefined values are used to fill up.  
If the function needs less parameters, additional ones are dropped.  
  
Returns the result of the function converted to FileMaker, e.g. as text or number value.  
  
If you like to use JSON instead, please put in properties or pass JSON as string and let JavaScript decode it as part of the function.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat Parameters parameter as often as you need.  
### Examples

Call a Test function and pass two numbers:

 Show Custom Dialog \[ MBS ( "JavaScript.CallFunction"; $$Context ; "Test"; 5.3 ; 3 ) \]  
### See also

- [JavaScript.CF](JavaScriptCF.md)

### Release notes

- **Version 12.2**
    - Added [JavaScript.CallFunction](https://www.mbsplugins.eu/JavaScriptCallFunction.shtml), [JavaScript.GetPropertyJSON](https://www.mbsplugins.eu/JavaScriptGetPropertyJSON.shtml) and [JavaScript.SetPropertyJSON](https://www.mbsplugins.eu/JavaScriptSetPropertyJSON.shtml) functions.

### Example Databases

- [JavaScript WebKit/JavaScriptMac Custom Functions](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/JavaScript%20WebKit/JavaScriptMac%20Custom%20Functions.shtml#5ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin 12.2](https://www.mbsplugins.de/archive/2022-06-09/MBS_FileMaker_Plugin_122/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 12.2 für Claris FileMaker](https://www.mbsplugins.de/archive/2022-05-17/Neues_MBS_Plugin_122_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 12.2 for Claris FileMaker](https://www.mbsplugins.de/archive/2022-05-17/MBS_Plugin_122_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [Custom Functions in JavaScript reloaded](https://www.mbsplugins.de/archive/2022-05-05/Custom_Functions_in_JavaScript/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.2pr5](https://www.mbsplugins.de/archive/2022-05-04/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 3th May 2022 , last changed 9th February 2023

  
[JavaScript.CF](JavaScriptCF.md) - [JavaScript.CheckScriptSyntax](JavaScriptCheckScriptSyntax.md)

[HTML Version](JavaScriptCallFunction.shtml)