Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

JavaScript to show/hide sub-grid based on checkbox selection onload?

$
0
0

Hello,

Our organization uses Dynamics CRM 2015 on premise. I am attempting to create a javascript function within the Order entity to hide/show a custom entity subgrid based on a checkbox selection. I want this to occur on load at the moment, I may also implement it on change of that field if I can get it working this way first. Below is the script I have so far.

function hardwareIncluded(){
var HardwareStatus = Xrm.Page.getAttribute("new_hardwareincluded").getValue();
if(HardwareStatus == false)
{
Xrm.Page.ui.controls.get("HardwareShipments").setVisible(false);
}
else
{
Xrm.Page.ui.controls.get("HardwareShipments").setVisible(true);
}
}

In this script, "new_hardwareincluded" is the name of the two option field that is configured as a checkbox at the moment. "HardwareShipments" is the name of the subgrid within the Order form where this Javascript is being called on as an onload function. Below is an image of the error I am currently getting when I open an Order record, I tried with one that was checked and one that was not checked, same result. Any thoughts on this? Thanks!


Viewing all articles
Browse latest Browse all 46379

Trending Articles