Posts

Showing posts with the label subgrid

DYNAMICS 365 HOW TO CHANGE SUBGRID SELECTED VIEW IN JAVASCRIPT

Image
In other posts, we saw how to refresh a subgrid and how to filter a subgrid in JavaScript. In this post, we will see how to change the view selected for the subgrid in JavaScript . You can use this each time you need to display different columns in a sub grid based on a field value on the form because showing/hiding a column in a sub grid is not possible. Go to the entity form and open the form or field properties where you want to call the JavaScript function Under the Events tab, add the appropriate event handler and call the function that will change the subgrid view Save and Publish the form As outlined in the below JavaScript function, use the setCurrentView function to change the subgrid view . func...

DYNAMICS 365 HOW TO FILTER SUBGRID IN JAVASCRIPT

Image
In other posts, we saw how to change the selected view of a subgrid and how to refresh a subgrid in JavaScript. In this post, I will talk about how to filter a subgrid using JavaScript in Dynamics 365 and display the needed records . For the sake of this post, I will take the example of an account record and its related cases that are displayed in a sub-grid component. In the account record, a field called Case Type that contains three options (Problem, Question, Request) Based on the case type selected, the sub-grid should be filtered and show the appropriate cases records To apply a filter on the subgrid, a fetchXml needs to be injected in the sub-grid and filtered based on the case type selected Therefore, go to the Case for...

DYNAMICS 365 HOW TO REFRESH SUBGRID IN JAVASCRIPT

Image
In other posts, we saw how to change the selected view of a subgrid and how to filter subgrid in JavaScript. In this post, we will see how to refresh a subgrid in JavaScript in order to show the latest records related to a parent record upon an action on the form or clicking a ribbon button. For the sake of this post, I will take the example of the cases subgrid related to an account record. Let's take the scenario, where an action is done on the client side that adds a case related to the account record. Therefore, the sub-grid should be automatically refreshed to reflect the updated list of cases. In order to do this, a JavaScript function should call the refresh() in order to refresh the subgrid and display the expected result. function refreshSubGrid(context) { var formContext = context.getFormContext(); ...

DYNAMICS 365 BLANK SUBGRID IN QUICK VIEW

Image
In this quick post, I will describe a strange issue I have faced on CRM on-premises V9 in a quick view with a sub-grid component in it. Most of you have worked with quick views and you know that you can add a sub grid in it to display records related to a specific record selected in a lookup field. PROBLEM When a lookup field is selected and its related quick view has appeared, the sub-grid existing in the quick view is blank and never loads as displayed in the below screenshot. REASON The tab containing the quick view with a sub-grid is collapsed by default SOLUTION Put the tab as expanded by default, and after save and publish, the sub-grid in the quick view is properly shown. Hope This Helps!