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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Using Javascript to get the name or label of a sub grid?

(0) ShareShare
ReportReport
Posted on by 1,591

I have an entity named Franchise Config and on one of its Forms named Franchise Defaults (shown below) I have many Subgrids (sub grids names are circled in purple below) that point to various views on a different entity named Franchise Defaults.

Screen-Shot-2021_2D00_05_2D00_12-at-5.24.40-PM.png

An example of one of the subgrids showing the name and label along with the selected view can be seen below.

Screen-Shot-2021_2D00_05_2D00_12-at-5.30.37-PM.png

I have customized the + new franchise default button (circled in turquoise above) via ribbon workbench so that it executes a custom script. 

I need to make the custom script get either the name or label of the subgrid properties area the + new franchise default button is clicked from.

 I need to pass the name or label of the subgrid to another function that opens a new create form and pre-populates a bunch of different values based on the name or label that is passed.  

How can I get the name or label of the subgrid properties area the + new franchise default button is clicked from via JavaScript that runs when the button is clicked?

Any help would be greatly appreciated. 

I have the same question (0)
  • Verified answer
    vishal bagadia_crm Profile Picture
    490 on at

    Hello Jim,

    In the ribbon workbench you can pass CRM Parameter as "SelectedControl" to your function, which can give you more details in your javascript

    pastedimage1620889834973v1.png

    Regards,

    CRM Developer

  • ACECORP Profile Picture
    1,591 on at

    Your example shows a sales order line items button, but I would be using the +new button.

    Does that matter? I see in ribbon workbench that same parameter is present on the new button.

    Do I need to change the script that is run when the new button is pressed or can I simply adds function to on load of the form that opens up when the new button is pressed and check the SelectedControl.name to get the name?

    Any additional specificity you can provide would be very helpful.

  • ACECORP Profile Picture
    1,591 on at

    Awesome. I customized the button and changed the command so that it executes my script (shown below) and function instead of the OOB.

    function GetFranchiseDefaultType(primaryControl, SelectedControl) {
        debugger;
        "use strict";
        alert("Selected Control Name is: "   SelectedControl.name);
        }

    The button and command customizations are shown below and this works! 

    Screen-Shot-2021_2D00_05_2D00_13-at-3.40.00-PM.png

  • vishal bagadia_crm Profile Picture
    490 on at

    Hello Jim,

    The screenshot I shared shows custom button of my project. Its just for the reference. You will see the parameter options for any OOB/custom entity in any project.

  • vishal bagadia_crm Profile Picture
    490 on at

    Perfect.. That is exactly I was trying to convey.

    will try to be more precise and clear about the answers I send from next time so that person can understand very clearly without any issues..

    Thank you for your replies and feedback.

    Regards,

    CRM Developer

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 44

#2
sannavajjala87 Profile Picture

sannavajjala87 25

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 22 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans