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 :
Customer experience | Sales, Customer Insights,...
Answered

Show/hide Subgrid Plus button based on form Attribute value

(0) ShareShare
ReportReport
Posted on by 383

Hello Team,

I'm trying to show/hide  + Add button on sub grid based on attribute value. I'm having 2 sub-grids with different views(same entity) on my form , one is displaying all records and 2nd one is displaying only related records.

i did customized +New button command and added new custom enable rule with custom Java script web resource using ribbon work bench and it's working fine for the sub grid with All records view but not working on the sub grid with only related records view . Did i miss anything ?  Any help would be appreciated . Thank You. 

 function DisableNewButton() {
var approved = Xrm.Page.getAttribute("ca_approved").getValue();
if(approved == true)
{
return false;
}
else{
return true;
}
}

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hey ZeroHar,

    this sounds like an interesting issue.

    I am not fully sure how this issue may occur but I would recommend trying to use the ValueRule in your case. That way you do not need a JS at all:

    pastedimage1580247686090v1.png

    I would guess a ValueRule should look like this for your requirement:

    pastedimage1580248822055v4.png

    On "Default" (false) the Rule would hide the ribbon and whenever the value of the field "ca_approved" equals "true" (ca_approved == true --> true), it inverts the result true to false and hides the ribbon.
    Difficult to explain but pretty simple in its function.

    Maybe you could try using that and see whether that delivers a better result for your requirement.

  • ZeroHar Profile Picture
    383 on at

    Thanks for the response. I found the reason, it's two different buttons for the two sub-grids.

    "NEW" button for the 'all records' View  .

    "ADD NEW" button for the "Only related records" View

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 94 Super User 2026 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#3
11manish Profile Picture

11manish 68

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans