Bearbeiten

Teilen über


RecordRef.Modify([Boolean]) Method

Version: Available or changed with runtime version 1.0.

Modifies a record in a table.

Syntax

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

Parameters

RecordRef
 Type: RecordRef
An instance of the RecordRef data type.

[Optional] RunTrigger
 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

[Optional] Ok
 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.

Remarks

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).

RecordRef Data Type
Get Started with AL
Developing Extensions