Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Sales forum / Updating Parent Record...
Sales forum
Unanswered

Updating Parent Record on delete of editable Sub-grid record

Posted on by 18

I have a parent record (budget) that I need to have a live update on the total of the child records (budget items). Each time the a Budget Item is updated/added/removed, I need to the parent records to update the total. This needs to be done on the parent (budget) form in real time with the budget items being in an editably sub-grid.

I tried the following code

var gridContext = formContext.getControl('EditableSubGridName');//Verify the subgrid is loaded, if not recursively call function againif (gridContext != null && gridContext != undefined) {    gridContext.addOnLoad(CalculateTotal);}

The above only gets called on a Save, it is not triggered on a deletion of a sub-grid record.

Categories:
  • Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Updating Parent Record on delete of editable Sub-grid record
    Hi Partner,
    Sometimes sub-grid take more time to load onto the form than other controls, try adding the setTimeout() function to ensure that if your javascript code is executed before the control is available, we will wait and then try to attach the event to the control again.
    Please refer to the following links for more details:
    Make sure that add the CalculateTotal function that you used in addonLoad() to the subgrid OnLoad event.

    I hope you can verify my answer if it helps you! If you have any questions, please feel free to contact me.
    Regards,
    Leah

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,339 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,177 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans