JS.CF
-----

Calls a global function given the name with FileMaker values.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [JavaScript](component_JavaScript.md) | [11.3](newinversion113.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "JS.CF"; Name { ; Parameters... } ) 

**MBS**( **"JS.CF";** /\* Calls a global function given the name with FileMaker values. \*/  
**$Name**; /\* The name of the function.e.g. "test" \*/   
**$Parameters...**) /\* Optional; Value to pass as parameter. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Name | The name of the function. | "test" |  |
| Parameters... | Value to pass as parameter. |  | Optional |

### Result

Returns OK or error.

### Description

Calls a global function given the name with FileMaker values.  
Please initialize the global "js" JavaScript environment before (see [JS.New](JSNew.md)) and fill it with function definitions as needed (see [JS.AddFunction](JSAddFunction.md)). This may include functions to do FileMaker evaluate (see [JS.AddFileMakerEvaluateFunction](JSAddFileMakerEvaluateFunction.md)), SQL execute (see [JS.AddFileMakerSQLFunction](JSAddFileMakerSQLFunction.md)) and starting scripts (see [JS.AddFileMakerRunScriptFunction](JSAddFileMakerRunScriptFunction.md)).  
  
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.  
There is no limit in the number of parameters for MBS Plugin here.  
  
Returns the result of the function converted to FileMaker, e.g. as text or number value.  
  
Same as [JS.CallFunctionValues](JSCallFunctionValues.md), but takes "js" as the global JavaScript engine. See our example for JavaScript Custom Functions.  
  
See also FM.[CF](CF.md) and [CF](CF.md) function to do custom functions with FileMaker expressions.  
  
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 Concat function:

 MBS ( "JS.[CF](CF.md)"; "Concat"; Value1, Value2)  
Call a function and pass field value, calculation and hard coded value:

 MBS ( "JS.[CF](CF.md)"; "Test"; MyTable::MyField ; Get(AccountName); "Hello"; Round($Total + ($Total \* $taxRate ); 2) )  
### See also

- [FM.CF](FMCF.md)
- [JS.AddFileMakerEvaluateFunction](JSAddFileMakerEvaluateFunction.md)
- [JS.AddFileMakerRunScriptFunction](JSAddFileMakerRunScriptFunction.md)
- [JS.AddFileMakerSQLFunction](JSAddFileMakerSQLFunction.md)
- [JS.AddFunction](JSAddFunction.md)
- [JS.CallFunction](JSCallFunction.md)
- [JS.CallFunctionValues](JSCallFunctionValues.md)
- [JS.New](JSNew.md)

### Release notes

- **Version 11.3**
    - Added [JS.CF](https://www.mbsplugins.eu/JSCF.shtml) and example database for custom functions with JavaScript.

### Example Databases

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

### Blog Entries

- [New in MBS FileMaker Plugin 11.3](https://www.mbsplugins.de/archive/2021-07-27/New_in_MBS_FileMaker_Plugin_11/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 11.3](https://www.mbsplugins.de/archive/2021-07-12/Neues_MBS_FileMaker_Plugin_113/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 11.3 - More than 6500 Functions In One Plugin](https://www.mbsplugins.de/archive/2021-07-12/MBS_FileMaker_Plugin_113_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS @ FMTraining.TV](https://www.mbsplugins.de/archive/2021-07-03/MBS_@_FMTrainingTV/monkeybreadsoftware_blog_filemaker)
- [Custom Functions stored in a database](https://www.mbsplugins.de/archive/2021-06-15/Custom_Functions_stored_in_a_d/monkeybreadsoftware_blog_filemaker)
- [Custom Functions in JavaScript](https://www.mbsplugins.de/archive/2021-06-14/Custom_Functions_in_JavaScript/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.3pr2](https://www.mbsplugins.de/archive/2021-06-09/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2021, Seite 24 bis 25](https://filemaker-magazin.de/neuigkeit/4152-Appetithappen-FMM_202104)

This function checks for a license.

Created 4th June 2021 , last changed 26th June 2025

  
[JS.AddFunction](JSAddFunction.md) - [JS.CallFunction](JSCallFunction.md)

[HTML Version](JSCF.shtml)