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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Capturing the onLoad event of the Associated Grid View

(0) ShareShare
ReportReport
Posted on by 80

Does anyone have an idea how to capture the onLoad event of the associated grid like you can with grid views on the normal form?

Annotation-2020_2D00_05_2D00_05-092209.png

For a gridview I place on the form I can user this https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/grids/gridcontrol/addonload

But in the case of the associated view I don't know the name of the grid because It's a default system grid so I cannot bind JavaScript to It. In this case I need to capture the onLoad event so I can update a total hours field after a delete action. This already works of the gridview I placed on the form myself.

I have the same question (0)
  • Johao Larios Profile Picture
    1,795 on at

    Hello Edwin,

    Are you able to modify that view in the UI? If I'm getting your questions correctly, there is no way to modify that directly even using JS.

    What you could do is use a webapi call to update the record that you want to update or just add a subgrid inside the form containing the view you need to manipulate and then use the gridControl for this new grid.

    regards,

  • Edwin Hebbink Profile Picture
    80 on at

    Hi Johao.. The problem is that I have a total hours field on the parent entity that is the total of hours registered in the child entity. So if I delete a childrow from the grid the total is recalculated in a plugin. Only I have to refresh the parent page to show the new total. That works from the normal grid because I can capture the GridOnLoad event and refresh the page. But on the normal grid there is also a button "Show Associated Records" en if you click that you go to the Associated View Grid.. If I delete a child line from that grid the page cannot be refreshed because I cannot add the gridContext.addOnLoad(myFunction) to that grid.

     Annotation-2020_2D00_05_2D00_05-135819.png

  • Johao Larios Profile Picture
    1,795 on at

    Edwin,

    Thanks for the quick response. Now I understand your issue. unfortunately there is no supported way to access the onload event for those grids. I would suggest you open an idea here: experience.dynamics.com/.../

    To refresh the page after do the webapi thing that I mentioned, you can use this:

    formContext.data.refresh(save).then(

    function () {

    // success

    }, function (error) {

    // failure

    // you get more information about why saving data failed in error argument:

    var errorCode = error.errorCode;

    var errorMessage= error.message;

    alert(errorCode +" "+error.errorMessage)

    }

    );

    docs.microsoft.com/.../refresh

    this will retrieve to the form the newer data.

    If this solved your question, please mark it as answered.

    Let me know if you have any questions.

  • Edwin Hebbink Profile Picture
    80 on at

    Thanks for trying to help and I know that's how you refresh a page because that works on the grid I placed on the form but this grid I'm talking about is the standard MS grid and when I delete a record there I have now way of triggering a JavaScript.. That is the whole question. I'll try to send the question to MS.. Thanks..

  • Johao Larios Profile Picture
    1,795 on at

    Edwin,

     Thanks for elevate this to Microsoft directly.

    Please, once you get an answer could you share it over her and mark this thread as answered? so if any one else is looking for this could see the information.  

    Have a nice day.

    Regards,

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You can hide that button from ribbon workbench. Create new solution ->Add subgrid entity in solution->open ribbon workbench->Choose solution-> Navigate to Sug grid section of ribbon->right click on Open aasociated grid view->Hide->Publish changes

    CQ12.PNG

    If found helpful, Please mark my answer verified.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans