Modify Method

Modifies a record in a table.


[Ok := ]  RecordRef.Modify([RunTrigger: Boolean])


 Type: RecordRef
An instance of the RecordRef data type.

 Type: Boolean
Specifies whether to run the AL code in the OnModify Trigger. If this parameter is true, then the code in the OnModify trigger is executed. If this parameter is false (default), then the code is not executed.

Return Value

 Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.


Select the record that you want to modify by using the primary key fields. The record's current key and filters do not affect the operation.

If an end-user modifies a record between the time that another end-user or another process reads the record and modifies it, then the second user must refresh the value of the record variable before editing the record. Otherwise, the end-user receives the following run-time error:

Another user has modified the record for this <Table Name> after you retrieved it from the database.

Enter your changes again in the updated window, or start the interrupted activity again.

In earlier versions of Dynamics 365, certain situations allowed code that an end-user runs to modify a record after a newer version of the record was written and committed to the database. This would overwrite the newer changes. However, in Dynamics 365 Business Central, we have restricted the MODIFY Method (RECORDREF), RENAME Method (RecordRef), and DELETE Method (RecordRef) so that the end-user receives the following run-time error in these certain situations:

Unable to change an earlier version of the <Table Name> record. The record should be read from the database again. This is a programming error.

You must design your application so that you use the most up-to-date version of the record for modifications to the database. You use the GET Method (RecordRef) to refresh the record with the latest version.

This method works the same as the MODIFY Method (Record).

See Also

RecordRef Data Type
Getting Started with AL
Developing Extensions