FM.UpdateRecord
---------------

Update an existing record in a table in one line.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [FM](component_FM.md) [FMSQL](component_FMSQL.md) | [6.0](newinversion60.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "FM.UpdateRecord"; FileName; TableName; IDField; IDValue; FieldName...; FieldValue... ) 

**MBS**( **"FM.UpdateRecord";** /\* Update an existing record in a table in one line. \*/  
**$FileName**; /\* The file name of where the table is inside. Can be empty to look for the table in all files.  
  
Using a table in another database file may require you adding the other file as an external data source and adding the external table to your relationship graph to grant access.e.g. Get(FileName) \*/   
**$TableName**; /\* The name of the table to insert record into.  
Can be ID of table, so we lookup name by ID.   
Can be result of GetFieldName() function as we remove field name automatically.e.g. "Assets" \*/   
**$IDField**; /\* The name of the field which provides an unique ID for each record, so we can identify the field.  
Can be ROWID for the record ID.  
  
Can be ID of field, so we lookup name by ID.   
Can be result of GetFieldName() function as we remove table name automatically.e.g. "ID" \*/   
**$IDValue**; /\* The value for the ID field to identify the record.  
Data type of parameter must match the data type of the field.e.g. $RecordID \*/   
**$FieldName...**; /\* A field name to set.  
Can be ID of field, so we lookup name by ID.   
Can be result of GetFieldName() function as we remove table name automatically.e.g. "Model" \*/   
**$FieldValue...**) /\* A field value to use for setting the field in the parameter before.  
Data type of parameter must match the data type of the field.e.g. "Test" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| FileName | The file name of where the table is inside. Can be empty to look for the table in all files.      Using a table in another database file may require you adding the other file as an external data source and adding the external table to your relationship graph to grant access. | Get(FileName) |
| TableName | The name of the table to insert record into.   Can be ID of table, so we lookup name by ID.    Can be result of GetFieldName() function as we remove field name automatically. | "Assets" |
| IDField | The name of the field which provides an unique ID for each record, so we can identify the field.   Can be ROWID for the record ID.      Can be ID of field, so we lookup name by ID.    Can be result of GetFieldName() function as we remove table name automatically. | "ID" |
| IDValue | The value for the ID field to identify the record.   Data type of parameter must match the data type of the field. | $RecordID |
| FieldName... | A field name to set.   Can be ID of field, so we lookup name by ID.    Can be result of GetFieldName() function as we remove table name automatically. | "Model" |
| FieldValue... | A field value to use for setting the field in the parameter before.   Data type of parameter must match the data type of the field. | "Test" |

### Result

Returns OK or error.

### Description

Update an existing record in a table in one line.  
You pass to this function table name (and optional filename).  
To identify the record you pass the name of the ID field and the value for the record. The ID field must be unique.  
Then you pass one pair of field name and value for each field you like to like to change in the record.  
  
Please note that FM.UpdateRecord and [FM.UpdateRecords](FMUpdateRecords.md) are nearly identical. Just FM.UpdateRecord provides the check to make sure only one record matches while [FM.UpdateRecords](FMUpdateRecords.md) allows several records to be updated. So with [FM.UpdateRecords](FMUpdateRecords.md) you can easily erase a lot of data if you pass wrong ID!  
  
With plugin version 7.2 or later, you can specify fields and table via IDs and the plugin will lookup them for you at runtime. Table IDs and table names must be unique across all open files for this to work correctly.  
  
With plugin version 8.4 or newer, you can use GetFieldName() function to query field names and the plugin removes the table prefix with :: in the field name before passing it to SQL engine.  
  
You can use [FM.ExecuteSQL.LastSQL](FMExecuteSQLLastSQL.md) function to see later what SQL was created and run.  
The [SQL](component_SQL.md) functions in FileMaker do not trigger OnWindowsTransaction script trigger.  
  
If the record is locked, you get an error like this: \[MBS\] ERROR: (301): Record is locked by another user.  
Your script may then wait and try again later.  
  
Does not take part in transactions in FileMaker. Changes are made directly to the database, so you can't revert them later with Revert Transaction script step.  
  
Please consider using newer [JSON.UpdateRecord](JSONUpdateRecord.md) and [JSON.UpdateRecords](JSONUpdateRecords.md) functions as they take a variable number of primary keys.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat FieldName and FieldValue parameters as often as you need.  
### Examples

Update a record:

 MBS ( "FM.UpdateRecord";   
""; "Asset Management"; /\* file and table name \*/  
"Asset ID"; "1"; /\* ID field and value \*/  
"Information"; "Just a test"; /\* first field and value \*/  
"Category"; "BestItems" ) /\* second field and value \*/  
Update a record:

 MBS ( "FM.UpdateRecord"; Get(FileName); "Kontakte"; "Vorname"; "Joe"; "Firma"; "Test" )  
Update a repeating field:

 Set Variable \[ $r ; Value: MBS ( "FM.UpdateRecord"; ""; "Contacts"; "RowID"; 1; "repeating\[5\]"; "Hello" ) \]   
Show Custom Dialog \[ Get ( RecordID ) &amp; ": " &amp; Contacts::repeating \[5\] \]  
### See also

- [FM.DeleteRecord](FMDeleteRecord.md)
- [FM.UpdateRecord2](FMUpdateRecord2.md)
- [FM.UpdateRecord3](FMUpdateRecord3.md)
- [FM.UpdateRecord4](FMUpdateRecord4.md)
- [FM.UpdateRecord5](FMUpdateRecord5.md)
- [FM.UpdateRecords](FMUpdateRecords.md)
- [FM.UpdateRecords2](FMUpdateRecords2.md)
- [FM.UpdateRecords4](FMUpdateRecords4.md)
- [FM.UpdateRecords5](FMUpdateRecords5.md)
- [JSON.UpdateRecords](JSONUpdateRecords.md)

### Release notes

- **Version 14.5**
    - Added [FM.UpdateRecord4](https://www.mbsplugins.eu/FMUpdateRecord4.shtml), [FM.UpdateRecord5](https://www.mbsplugins.eu/FMUpdateRecord5.shtml), [FM.UpdateRecords4](https://www.mbsplugins.eu/FMUpdateRecords4.shtml) and [FM.UpdateRecords5](https://www.mbsplugins.eu/FMUpdateRecords5.shtml) functions.
- **Version 12.4**
    - Fixed a problem with [FM.InsertRecord](https://www.mbsplugins.eu/FMInsertRecord.shtml) and [FM.UpdateRecord](https://www.mbsplugins.eu/FMUpdateRecord.shtml) functions. They now ignore empty field names.
- **Version 10.1**
    - Changed [FM.InsertRecord](https://www.mbsplugins.eu/FMInsertRecord.shtml), [FM.CompareTables](https://www.mbsplugins.eu/FMCompareTables.shtml), [FM.DeleteRecord](https://www.mbsplugins.eu/FMDeleteRecord.shtml), [FM.DeleteRecords](https://www.mbsplugins.eu/FMDeleteRecords.shtml), [FM.InsertOrUpdateRecord](https://www.mbsplugins.eu/FMInsertOrUpdateRecord.shtml) and [FM.UpdateRecord](https://www.mbsplugins.eu/FMUpdateRecord.shtml) to take table name from first field name if table name is empty.
- **Version 9.3**
    - Changed field quoting for [FM.UpdateRecord](http://www.mbsplugins.eu/FMUpdateRecord.shtml) and others to not quote ROWID as field name.
- **Version 8.5**
    - Changed [FM.UpdateRecords](http://www.mbsplugins.eu/FMUpdateRecords.shtml) and related to better return error if parameter count is too small.
- **Version 8.0**
    - Added [FM.UpdateRecord2](http://www.mbsplugins.eu/FMUpdateRecord2.shtml), [FM.UpdateRecord3](http://www.mbsplugins.eu/FMUpdateRecord3.shtml), [FM.UpdateRecords2](http://www.mbsplugins.eu/FMUpdateRecords2.shtml) and [FM.UpdateRecords3](http://www.mbsplugins.eu/FMUpdateRecords3.shtml).

### Example Databases

- [Mac and iOS/MapKit/MapView Click Polygons](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/MapKit/MapView%20Click%20Polygons.shtml#12ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 18 - Update](https://www.mbsplugins.de/archive/2025-12-18/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Insert or update with JSON](https://www.mbsplugins.de/archive/2024-08-28/Insert_or_update_with_JSON/monkeybreadsoftware_blog_filemaker)
- [New records without layout change in FileMaker](https://www.mbsplugins.de/archive/2023-08-24/New_records_without_layout_cha/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.4pr4](https://www.mbsplugins.de/archive/2022-08-30/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS @ FMTraining.TV](https://www.mbsplugins.de/archive/2022-08-29/MBS_@_FMTrainingTV/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.1pr1](https://www.mbsplugins.de/archive/2020-01-30/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.3pr1](https://www.mbsplugins.de/archive/2019-06-03/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 6.0 for OS X/Windows](https://www.mbsplugins.de/archive/2016-01-28/MBS_FileMaker_Plugin_60_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.5pr1](https://www.mbsplugins.de/archive/2015-12-09/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2018, Seite 23 bis 24](https://filemaker-magazin.de/neuigkeit/4025-Appetithappen-FMM_201806)
- [Ausgabe 3/2018, Seite 35](https://filemaker-magazin.de/neuigkeit/3953-Appetithappen-FMM_201803)
- [Ausgabe 1/2016, Seite 32](https://filemaker-magazin.de/neuigkeit/3870-Appetithappen-FMM_201601)

This function checks for a license.

Created 5th December 2015 , last changed 10th November 2025

  
[FM.TextWithDataType](FMTextWithDataType.md) - [FM.UpdateRecord2](FMUpdateRecord2.md)

[HTML Version](FMUpdateRecord.shtml)