NAV does some rollback automatically. But if there is a COMMIT
statement in the code, only the changes after the COMMIT
statement is executed will be reversed by the system. This recipe will show you how to leverage a built-in NAV feature called the Change Log to build your own rollback routine for those cases.
Add a function named
FilterRecord
that takes in the following parameters:Name
Type
Subtype
ChangeLogEntry
Record
Change Log Entry
PrimaryKeyIndex
Integer
RecRef
RecordRef
Add the following local variables to the function:
Name
Type
Length
FieldRef
FieldRef
TypeNumber
Decimal
PrimaryKeyFieldNo
Integer
PrimaryKeyValue
c
250
Add the following code to the function:
WITH ChangeLogEntry DO BEGIN CASE PrimaryKeyIndex OF 1: BEGIN PrimaryKeyFieldNo := "Primary Key Field 1 No."; PrimaryKeyValue := "Primary Key Field...