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 :
Finance | Project Operations, Human Resources, ...
Answered

Child grid calculated field not refreshing when parent changes

(6) ShareShare
ReportReport
Posted on by 324

Question

I have a form in Dynamics 365 Finance & Operations with a parent–child data source structure.


  • Parent: JobLine

  • Child: Layer

In the child grid, there is a calculated field (for example, Ampere) that is calculated from:


  • Fields in the parent table (Quantity, Area)

  • And data from another table (MasterTable.Multiple)

The calculation is correct at the database level, but the issue is UI refresh timing.

Observed behavior:


  • When Quantity or Area is changed in the parent record

  • The calculated value in the child grid does not update immediately

  • The value only updates after clicking around the form, changing focus, or reselecting the record

Question:

What is the correct, framework-compliant approach in D365FO to make a calculated/displayed field in a child data source update immediately (in real time) when values in the parent data source change?

Any guidance or best-practice approach would be appreciated.

Categories:
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    303,730 Super User 2026 Season 1 on at
    Hi Statics 365,
     
    There are several commands for refreshing/rereading the data source or form. You can call such method at e.g. the write event of the parent data source.
  • Suggested answer
    Sagar121 Profile Picture
    1,160 Super User 2026 Season 1 on at
    Hi, 
     
    If you have created display method then you need to put JobLine_ds.observe(). Your child DS don't know then parent DS is changed.
  • Statics 365 Profile Picture
    324 on at
    Thank you for your reply.
    Let me clarify my scenario again:
    - The Ampere field is already implemented as a display method.
    - The display method is on the child table (Layer).
    - The calculation depends on fields from the parent data source (JobLine).
    I understand that the child data source needs to be notified when the parent changes.
    However, I’m still not sure how this should be implemented correctly according to the framework.
    Could you please provide a working code example showing:
    - where observe() should be called
    - and how the parent and child data sources should be wired together
    so that the display method refreshes immediately when the parent record changes?
    Thank you in advance.
     
  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at
    You need to call the observe() method of JobLine data source in your display method. Check out Display methods and Form Observability for more details.
  • Verified answer
    Sagar121 Profile Picture
    1,160 Super User 2026 Season 1 on at
    Hi,
     
    Assume you have created display method at form DataSource level so you can call JobLine_ds.observe() inside your display method.
  • Statics 365 Profile Picture
    324 on at
    Thank you for the suggestion to use observe(). That solved the issue.
  • Statics 365 Profile Picture
    324 on at

    I also noticed another issue related to this and would like to ask for some advice.

    I have a display method on a form datasource grid. The calculation depends on the parent datasource (JobLine), the current Layer record, and a master table (Chemical), where Chemical.Multiple is retrieved using ChemicalCode.

    The formula is:

     
    ((JobLine.Quantity * JobLine.Plating_Area) / 100) * Chemical.Multiple
     

    The issue I am facing is that when the grid contains multiple Layer records with different ChemicalCode values, the display method sometimes returns the same value for multiple rows, even though Chemical.Multiple is different in the master table.

    If I debug record by record, the data and calculation are correct. However, during grid rendering, the calculated value appears to be reused across rows.

    In this scenario, what would be the recommended way to handle this correctly in D365FO?

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at
    It sounds like a bug in your code. Please show us the complete code of  your method and tell us where the method is placed.
  • Statics 365 Profile Picture
    324 on at

    Thanks for the response @Martin.

    At the time, I was using the following code.

    The display method is placed on the form datasource of Layer.

     

    [DataSource]
    class Layer
    {
        display real ampereDisplay()
        {
            // Observe parent datasource
            JobLine_ds.observe();
            JobLine line  = JobLine_ds.cursor();
            Layer   layer = this.cursor();
            Chemical_code  chem;
            if (!line || !layer)
                return 0;
            select firstOnly chem
                where chem.Chemical_code == layer.ChemicalCode;
            if (!chem)
                return 0;
            return
                ((line.Quantity * line.Plating_Area) / 100)
                * chem.Multiple;
        }
    }
     

    The issue occurs when the grid contains multiple Layer records with different ChemicalCode values.

    In that case, the display method sometimes returns the same calculated value for multiple rows, even though chem.Multiple is different.

    I would appreciate your guidance on what is wrong with this approach or what the recommended pattern would be in this scenario.

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at
    Okay, I see the bug. You always take the currently selected Layer record, but you need the record that the value is calculated for. You need to add a parameter of the method where the system will pass the Layer record, and use this parameter in your code.
     
    By the way, you don't need code like JobLine_ds.cursor(). The same value can be found in the automatically created variable with the name of the data source, i.e. jobLine.

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 March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans