eeRis Sprinkler v.22.0
for Microsoft Dynamics 365 Business Central up to v.24.0
RENAME Important Topic
For the RENAME operation it was observed a singular behavior to be careful of, while we are studying a specific solution.
Referential integrity management in case of RENAME
The RENAME management is particular, since Dynamics 365 Business Central apply the referential integrity management operations defined in the database, in addition to standard OnRename trigger code: for example, when the user apply a RENAME on a [Customer] record (changing its primary key), the same modfication is applied by Dynamics 365 Business Central also to the referencing fields of [Sales Header], [Sales Invoice Header] and so on (Sell-to Customer No. etc.)
Unfortunately, this management has not fully compatibility with the change detection method used by Sprinkler: in particular, Sprinkler detects and reports to the target system both the RENAME operation and all subsequent operation on others records (that could be MODIFY or even RENAME). These subsequent operation are not distinguished from the normal operations of MODIFY or RENAME, and they are considered new transactions.
In case of RENAME + MODIFY: the target system receives a report of RENAME and replicate it directly, automatically triggering the local referential integrity management system; the next MODIFY transaction will be considered an unnecessary step, not creating a real problem nor error logs.
In case of RENAME + RENAME: the problem arises when the modified field is referenced by a key. Let you think for example to have both the [Customer] table and the [Customer Bank Account] table set for replication: in this case, the key [No.] of [Customer] is referenced by the [Customer No.] field of [Customer Bank Account]. If you RENAME a Customer, the referential integrity management system also automatically performs a RENAME of the record of [Customer Bank Account] belonging to that Customer, if exists.
Sprinkler will report both the RENAME of the Customer and the RENAME of a corresponding record of the [Customer Bank Account]. The second operation, however, will find the record already renamed directly by the target Dynamics 365 Business Central referential integrity management system, so Sprinkler will raise a false positive error. This error (starting from v.0.5.00) is managed and reported in the [Data Distrib. Import Error] table because the record to be renamed does not exist anymore, but this behavior can be difficult to be recognized and understood.