web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Updating SystemModifiedAt Date when FlowField changes

(5) ShareShare
ReportReport
Posted on by 765
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.
I have the same question (0)
  • Suggested answer
    Wayne R Profile Picture
    99 on at
    Hi there,
     
    The SystemModifiedAt field on every record is a system field and is only updated when the record is truly modified. 
     
    Flowfields represent many types of fields, but in your case, they are "sums" of a collection of records so master data records are not "updated" at all, they are calculated each time you open the customer card or vendor card, so there is no update of information actually happening.
     
    These calculated fields represent many records that make up the sum, logically it does not make sense wanting to update the SystemModifiedAt each time there is a new posting, even for what you are trying to achieve.
     
    Based on the suggested code that you are looking to implement to update master records each time a posting occurs, will have serious consequences as far as performance is concerned as posting entries are generally many to one, which means you may fetch and modify a master record many times during one posting and that update would only be relevant for a very short time until the next posting occurs so performance tax will continually be paid.
     
    Perhaps if I can understand exactly what your intention is regarding the monitoring of the data and how you intend to do the comparison, I can suggest a better alternative that is less invasive.
  • Suggested answer
    YUN ZHU Profile Picture
    100,212 Super User 2026 Season 1 on at
  • ME-31032107-0 Profile Picture
    765 on at
     
    I am pulling down certain BC tables (both master and detailed records) to a local SQL server every 15 minutes for some reporting that was not feasible from within BC (SAAS).  I was hoping to use some of the flowfields in the master tables for some reporting, but since the program that pulls BC tables into local SQL is looking for incremental changes based on the SystemModifiedAt date, I cannot do that if the flowfield changes are not showing there was an update to the BC table.
     
    My only recourse is to truncate the local SQL tables and re-populate all records, which could take longer than the 15 minute interval requirement.
     
    Looking for a way to flag the master tables so that if there were postings affecting the flowfields, then I can trigger an update to the local SQL tables.
     
    Thanks.
  • ME-31032107-0 Profile Picture
    765 on at
     
    Is it possible to use OnInsert triggers within the Detailed table records to force an update to the master tables, thereby updating the SystemModifiedAt date value on the master tables?
  • Suggested answer
    OussamaSabbouh Profile Picture
    15,188 Super User 2026 Season 1 on at
    Hello,
     
    FlowFields don’t update SystemModifiedAt because they’re virtual and not stored, so recalculations don’t count as record changes. While your approach of forcing Modify(true) on posting events would technically bump SystemModifiedAt, it’s not recommended because it adds unnecessary writes during posting, can cause locking/performance issues, and may trigger unintended OnModify logic or integrations. Best practice is to base your ETL watermark on the actual source tables (Cust./Vendor Ledger Entry, Item Ledger Entry, Value Entry) instead of the master tables, or add your own custom “Last Aggregated Change” field and update that in a controlled way rather than modifying the record blindly.
     
    Regards,
    Oussama Sabbouh
  • Suggested answer
    Wayne R Profile Picture
    99 on at
    Hi There,
     
    I have given it some thought and here is an example of something you can do that will not affect posting. This is more work to develop, but you have full control of it and what information you want to check.
     
    - A "Master Data Compare" table that records the balance of each master record. 
    - A Codeunit that runs on a job queue at intervals, checking the balance and compares it to the "Master Data Compare".
    - If different, modify the master record ONCE (updating the SystemModifiedAt field), and update the Master Data Compare with the current value so the next time the job runs runs and the value has not changed, then don't modify the record.
     
    By using events on triggers as suggested:
    - this cannot be switched off, you have to make code changes to remove it, becomes critical if it is any emergency in production.
    - updates master records many times if triggers are on subledger entries.
    - if master record is locked, posting fails.
    - posting runs longer - every time.
    - introduce issues if failed postings does not roll back correctly.
     
    By using the Job Queue and running a codeunit at intervals:
    - gives total control of when it runs and you can stop it from running ANY TIME.
    - does not lock master data continuously as it only update ONCE, and only if value is different after last run.
    - commits each change immediately, meaning table locks are very short, and rollback is up to the last committed record if another user locks the current master record the job queue attempts to check.
    - does NOT affect posting for any user as it runs in the background.
    - efficient, using partial records (only specific fields of a record is loaded) so should process records quickly.
     
    Note: It is important to use partial records like I have in my attached example. You may used it and change it to your needs.
     
    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,012 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 986 Super User 2026 Season 1

#3
Teagen Boll Profile Picture

Teagen Boll 659 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans