JavaScript.SetProperty
----------------------

Sets property value.

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

MBS( "JavaScript.SetProperty"; JavaScriptContext; PropertyName; Value ) 

**MBS**( **"JavaScript.SetProperty";** /\* Sets property value. \*/  
**$JavaScriptContext**; /\* The reference number of the javascript context.e.g. $Context \*/   
**$PropertyName**; /\* The name of the property.e.g. "FirstName" \*/   
**$Value**) /\* The new text value.e.g. "Joe" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JavaScriptContext | The reference number of the javascript context. | $Context |
| PropertyName | The name of the property. | "FirstName" |
| Value | The new text value. | "Joe" |

### Result

Returns OK or error.

### Description

Sets property value.  
### Examples

Set and query property:

 Set Variable \[ $js ; Value: MBS ( "[JavaScript.New](JavaScriptNew.md)" ) \]   
Set Variable \[ $r ; Value: MBS ( "JavaScript.SetProperty"; $js ; "FirstName"; "Joe" ) \]   
Show Custom Dialog \[ "Result" ; MBS ( "[JavaScript.GetProperty](JavaScriptGetProperty.md)"; $js ; "FirstName" ) \]   
Set Variable \[ $r ; Value: MBS ( "[JavaScript.Release](JavaScriptRelease.md)"; $js ) \]  
### See also

- [JavaScript.EvaluateScript](JavaScriptEvaluateScript.md)
- [JavaScript.GetProperty](JavaScriptGetProperty.md)
- [JavaScript.GetPropertyJSON](JavaScriptGetPropertyJSON.md)
- [JavaScript.HasProperty](JavaScriptHasProperty.md)
- [JavaScript.New](JavaScriptNew.md)
- [JavaScript.Release](JavaScriptRelease.md)
- [JavaScript.SetPropertyJSON](JavaScriptSetPropertyJSON.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/JavaScript](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/JavaScript%20WebKit/JavaScript.shtml#5ScriptAnchor_)

### Blog Entries

- [Custom Functions in JavaScript reloaded](https://www.mbsplugins.de/archive/2022-05-05/Custom_Functions_in_JavaScript/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 5th November 2015 , last changed 9th February 2023

  
[JavaScript.ReleaseAll](JavaScriptReleaseAll.md) - [JavaScript.SetPropertyJSON](JavaScriptSetPropertyJSON.md)

[HTML Version](JavaScriptSetProperty.shtml)