Posts

Showing posts from May, 2023

Use of aggregate, groupby in fetchxml query

In Microsoft Dataverse, FetchXML  includes grouping and aggregation features that let you calculate sum, average min, max and count. groupby is used to get data from CRM and group it based on particular field value. To use group-by we need to use aggregate. e.g.; If we want to get group accounts based on country and we want count of those country in descending order then we will use fetchXML like below in c#. string accountNumber = "ANO10052023"; string fetchXML = @"<fetch aggregate='true' distinct='false' mapping='logical'> <entity name='account'> <attribute aggregate='countcolumn' alias='country_count' name='new_country'> <attribute alias='new_country' groupby='true' name='new_country'> <order alias='country_count' descending='true'/> <fi

Open custom page using JavaScript

Image
Custom pages are low code page type within model-driven apps. Custom pages bring the power of canvas apps into model-driven apps. Once we develop any custom page we will get its unique name from solution, that name of page will be used in JavaScript. We can also pass some data to custom page as a parameter which will be used by custom page for further processing. JavaScript snippet to call custom page: function callCustomPage(selectedItems) { var item = selectedItems; let pageInput = { pageType: "custom", name: "new_custompage_bb4a2", entityName: "incident", recordId: item, }; let navigationOptions = { target: 2, width: 400, height: 350, }; Xrm.Navigation.navigateTo(pageInput, navigationOptions) .then(function () { // Handle success }) .catch(function (error) { // Handle error }); } Here we are passing recordId as a additional parameter to custom page. Note: Please make sure to add cus

Customized Word Template in CRM based on selected records

Image
Word Template in Microsoft Dynamics CRM are used for creating word document dynamically for particular record. These documents help businesses visualize the data in CRM in different ways. With Document template, Users can generate standardized Word documents with just one click. Official documentation of using OOB word template -  Word Template There are certain limitations to the OOB word template provided by Dynamic CRM. e.g., we cannot select particular records from a sub-grid and export only those records in our Word template. To solve this issue, we can create a Word template and use that word template in power automate to populate the data of only selected records. Please follow the below steps to achieve this functionality. 1. Create a Word document template and store it in SharePoint or OneDrive:  Open Word Document and insert Table and give header to table, e.g., I have given header as ID and Type.  In second row we want to add sub-grid data based on records selected. So, we w