Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Need to get all selected row from editable sub grid in dynamics 365 using custom button

(0) ShareShare
ReportReport
Posted on by 319

Hello Everyone,

I have to get the GUID of all selected rows within the Editable Sub Grid on the click of custom button and need to pass these GUIDs to the plugins. But I'm not able to understand how to get GUID of all selected rows from the editable sub grid. I'm able to select one row but I'm not able to get GUID  of more than one selected rows within the editable sub grid. can anyone suggest that how to get all the selected rows from the editable subgrid.

thanks in advance.

  • M. N. Quraishi Profile Picture
    319 on at
    RE: Need to get all selected row from editable sub grid in dynamics 365 using custom button

    Thanks Adrian It's works for me but there is an another issue is that if select all the items using select all button then we are unable to read id. Even the method which you suggested is not working.
    kindly have a look below image.

     4454.Capture.PNG

    When we selecting all record using select all button which is highlighted with yellow then grid returning the zero (0) count.

    kindly suggest.

  • M. N. Quraishi Profile Picture
    319 on at
    RE: Need to get all selected row from editable sub grid in dynamics 365 using custom button

    Yes I mensioned the correct subgrid name and I want to let you know that I'm using the editable sub grid as I mensioned my question.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,025 Super User 2025 Season 1 on at
    RE: Need to get all selected row from editable sub grid in dynamics 365 using custom button

    Hi Mohd Nazish,

    Make sure to replace "GridName" with the name of your Sub-Grid.

  • M. N. Quraishi Profile Picture
    319 on at
    RE: Need to get all selected row from editable sub grid in dynamics 365 using custom button

    Hi Adrian,

    Thanks for the quick response.

    I already tried the above code which you mentioned but I'getting an error within forEach function that selectedRow is not defined.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,025 Super User 2025 Season 1 on at
    RE: Need to get all selected row from editable sub grid in dynamics 365 using custom button

    Hi Mohd Nazish,

    The approach is similar to my above comment, but replace the Ribbon Workbench button with a HTML web resource button that calls a JavaScript function when clicked. This article explains how to add a button that calls a JavaScript function when clicked to your HTML web resource.

    You can get the ID values from the selected rows with this JavaScript code.

    var selectedRows = Xrm.Page.getControl("GridName").getGrid().getSelectedRows();
    
    selectedRows.forEach(function(selectedRow, i) {
    entityGuid = selectedRow.getData().getEntity().getId(); });
  • M. N. Quraishi Profile Picture
    319 on at
    RE: Need to get all selected row from editable sub grid in dynamics 365 using custom button

    Hi Adrian Begovich,

    I have created a HTML button into the form using HTML web resource and I'm trying to fetch all the selected rows from the editable sub grid. But I'm unable to find the way to fetch these selected rows from the editable sub grid. My question is that how can I fetch the all the selected Rows from the editable grid on button click using javascript.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,025 Super User 2025 Season 1 on at
    RE: Need to get all selected row from editable sub grid in dynamics 365 using custom button

    Hi Mohd Nazish,

    You can create a custom button with the Ribbon Workbench for Dynamics 365 & Dynamics CRM. One option is to have the custom button call a JavaScript function that retrieves the records of the sub-grid entity filtered by the ID of the parent record using Web API REST endpoints. You will need to take the ID values of these records and pass them into your plugins using custom actions.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard > Dynamics 365 general forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans