Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


Friday Flash Tip: Hide or Show Sub Grids in CRM 2016 and Pick Selected Rows Using JavaScript

Post Author: Joe D365 |

Microsoft Dynamics CRM 2016 On-premises provides several new capabilities and methods to working with sub grids. Here are two quick tips for using those capabilities!

pexels-photo-51415

1. If you want to hide or show a sub grid based on some conditions, you will use the following command to set visibility:

Xrm.Page.getControl("gridname").setVisible(false);

2. If you need interact with the row that is being selected and get some information or populate specific data, CRM 2016 provides new methods that will give the user an option to interact with them. In this example, we are populating an array with the selected row from the grid. The array is a collection of entity references, for example, lookups:

var selectedRowsArray = [];

var selectedRows = Xrm.Page.getControl("gridname").getGrid().getSelectedRows();

selectedRows.forEach(

function (selectedRow, i) {

selectedRowsArray.push(selectedRow.getData().getEntity().getEntityReference());

});

That's all for the blog today! You can learn more by checking out The CRM Book, our blog, and this additional resource.

Happy CRM'ing!


Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends