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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Dynamcis Portal - Get subgrid.length to show/hide create button

(0) ShareShare
ReportReport
Posted on by

Hi

I have a Entity Form (Basic Webform) with 3 related subgrids (subgrid A, B, C). Is there a way to get table lenght from subgrid A via subgrid-schema-name that i set in the form options in dynamics? After i get the lenght from subgrid A, i will hide the create button if length is bigger then 0. We want to prevent the user from creating more than one record for subgrid A.

Is there a way to solve this problem?

To hide the button I already have a javascript function, but every "create-button" has the same id, and in my test the hidefunction hided all create button from all subgrids. I cannot limit the hide-function to subgrid A.

here is my code to hide "create-button":

$(".grid-actions").hide();
i hope someone can help
Thanks in advance
  • Verified answer
    Community Member Profile Picture
    on at

    Hi Partner,

    You should use following code to hide button of sub-grid in portal:

    $(document).ready(function(){
    
        // hide create button once sub-grid contains a record
        $(".entity-grid").on("loaded", function () {
            var tBody = $(this).find("tbody")
            if(tBody.length > 0)
            {        
                $(".grid-actions").hide();
            }
        });
    });

    However, if your form contains multiple subgrids.. you might consider finding your sub-grid by index for example:

    var subgridA = $(".entity-grid").eq(0);

    var subgridB = $(".entity-grid").eq(1);

    var subgridC = $(".entity-grid").eq(2);

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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 July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 42

#2
11manish Profile Picture

11manish 19 Super User 2026 Season 2

#2
Travis South Profile Picture

Travis South 19

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans