I am looking for a way to update the SystemModifiedAt date when a flow field in a table record is updated. My reason for this is that I am pulling down BC table records into a local SQL database, and I am evaluating changes based on the date the BC table record was last modified. Problem is that when flowfield values are updated (e.g., Customer balance in the Customer table), the SystemModifiedAt date value does not change. I understand the reasons for this, since flowfields are not "actual" fields stored in a table.
I also do not want to do full table truncation & refresh for time constraints due to volume of master records.
I am evaluating creating a CodeUnit that will perform a Rec.Modify event when there are postings from ledger records. Below is an example for 3 tables (Customer, Vendor & Item). Looking for advice whether this approach is sound, or may cause unintended issues:
codeunit 50107 FlowFieldUpdates
{
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterCustLedgEntryInsert', '', true, true)]
local procedure CustomerFF(var CustLedgerEntry: Record "Cust. Ledger Entry")
var
CustRec: Record Customer;
begin
if CustRec.Get(CustLedgerEntry."Customer No.") then begin
CustRec.Modify(true);
end;
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterVendLedgEntryInsert', '', true, true)]
local procedure VendorFF(var VendorLedgerEntry: Record "Vendor Ledger Entry")
var
VendRec: Record Vendor;
begin
if VendRec.Get(VendorLedgerEntry."Vendor No.") then begin
VendRec.Modify(true);
end;
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Line", 'OnAfterItemValuePosting', '', true, true)]
local procedure ItemFF(var ValueEntry: Record "Value Entry")
var
ItemRec: Record Item;
begin
if ItemRec.Get(ValueEntry."Item No.") then begin
ItemRec.Modify(true);
end;
end;
}
Thanks.