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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to get the parent and child sub grid name using ribbon workbench

(0) ShareShare
ReportReport
Posted on by 1,023

Hi,

I have the account entity and phone call subgrid. Now on the Phone call sub grid button click I want to get the parent and Child entity name dynamically. 

I  not sure which CRM parameters to pass to get this both names. Please suggest

Thanks.

I have the same question (0)
  • Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    pass PrimaryEntityTypeName & SelectedEntityTypeName

    If found helpful, Please mark my answer verified.

  • Verified answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    We could not get the parent entity directly, but we could get the relationship and then get the parent entity by its relationship.

    You could use gridContext.getRelationship to get relationship.

    pastedimage1594364430577v1.png

    pastedimage1594364459513v2.png

    Here's the sample code.

    //get current parent entity name in subgrid.
    function getParent(executionContext){
       var formContext=executionContext.getFormContext();
       var gridContext = formContext.getControl("Contacts"); // get the grid context
       gridContext.addOnLoad(onLoadSubgrid);
    
    }
    
    function onLoadSubgrid(executionContext){
        var formContext=executionContext.getFormContext();
        var gridContext = formContext.getControl("Contacts");
        var entityName=gridContext.getEntityName();
        var relationship=gridContext.getRelationship();
    }

    And if your child entity means the entity in the subgrid, you could use gridContext.getEntityName.

    pastedimage1594364606555v3.png

    Best Regards,

    Leo

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi James,

    Thanks for your recognition :)

    Regards,

    Leo

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 > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 41

#2
Martin Dráb Profile Picture

Martin Dráb 38 Most Valuable Professional

#3
Satyam Prakash Profile Picture

Satyam Prakash 35

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans