Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Get selected record GUID from OOB Associated subgrid of custom entity CRM 365 online

(0) ShareShare
ReportReport
Posted on by 42

Hi All,

We have 1 custom subgrid on main form of the entity and it shows all the active records of related entity. I have customize the + New button on subgrid and passing GUID of the selected record(row) to the custom HTML Page (+ New button opens custom HTML popup).

var selectedRows = formContext.getControl("subgridname").getGrid().getSelectedRows();
if (selectedRows.getLength() < 1) {

alert('no record selected');

}

else {
selectedRows.forEach(function (selectedRow, i) {
var entityGuid = selectedRow.getData().getEntity().getId().slice(1, -1);

}

This code is working fine for custom grid added by me on to the form BUT, we have OOB associated subgrid and +New button is same on both the grids(OOB)

When I click on +New on associated subgrid it checks custom subgrid "subgridname".

So my questions are

Is there any way to get subgrid name on + New button from both the subgrids ?
Is there any way to get associated view name in JavaScript like a custom subgrid ?
I need condition in JS code to check if it is associated grid or custom grid on +New button
Is there any alternative to this functionality
Need to detect +New button click whether it is from associated grid or custom grid ?


Please help me

Regards

Absha

  • RajarajanS Profile Picture
    RajarajanS on at
    RE: Get selected record GUID from OOB Associated subgrid of custom entity CRM 365 online

    Hey,

    By Associated subgrid, Is it the OOB subgrid on your main form, eg. Contact subgrid on Account Entity or is it accessing through the associated view, Eg. Opening the Associated Activities of a record.

    If you are trying to retrieve the OOB Subgrid name should be the under the properties of the subgrids: Entity> Forms> Open form> Subgrid> Change Properties> name

    Ref: docs.microsoft.com/.../viewselector this article details how to retrieve view from the grid

    to pass the grid context to the custom button ref to the article: docs.microsoft.com/.../pass-data-page-parameter-ribbon-actions

    Hope this helps.

    Regards,

    Raj

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans