You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Data API lets you set a [Modification ID](https://help.claris.com/en/data-api-guide/content/edit-record.html) when editing records.
243
+
244
+
> Specifying a modification ID ensures that you are editing the current version of a record. If the modification ID value does not match the current modification ID value in the database, the record is not changed.
245
+
246
+
If you wish to include the modId when editing a record you can call `withModId()` before calling `save()` on the model object. This will send the ModID to FileMaker when updating the record, and will throw a `FileMakerDataApiException` if the ModId does not match.
247
+
248
+
```php
249
+
$person->withModId()->save();
250
+
```
251
+
252
+
The modId is automatically set on the model object when you retrieve a record from FileMaker, so you don't need to set it manually.
253
+
254
+
255
+
If you always want the ModId to be included when saving a record, you can set the `$withModId` property to true on your model class.
256
+
257
+
```php
258
+
protected $useModId = true;
259
+
```
260
+
261
+
If you wish to always include a ModId on a model, you can set `protected $withModId = true;` on your model class.
240
262
241
263
## Example FMModel Class
242
264
```php
@@ -314,7 +336,8 @@ FM::setGlobalFields() // not chainable
314
336
->portalLimit( $portalName, $limit )
315
337
->portalOffset( $portalName, $startingRecord )
316
338
->sort() // alias for the native orderBy()
317
-
->omit()
339
+
->omit() // change the request to an "omit" request
340
+
->modId( string $modId ) // set the modId to submit when editing a record
0 commit comments