Posts

Validate Input Phone Number in Microsoft Dynamics CRM using JavaScript

Sometime we get requirement to validate a phone number like to check only numeric value allowed with all round bracket and '+' sign etc in the number. So below is a basic JavaScript fucntion which validates a phone number like: (022)6655-7878 or +91-7878787878 or +44-6756-6767-4234 and so on function CheckPhoneNoFormat(context) {     var oField = context.getEventSource().getValue();     if (typeof (oField) != "undefined" && oField != null) {         try {             var telnum = oField;             // Convert into a string and check that we were provided with something             var telnum = telnum + " ";             if (telnum.length == 1) {                 telNumberErrorNo = 1;                 return false    ...

How to get the entity schema name list registered in your Dynamics CRM Organization using C#.

Use the following code for fetching entity list names in your console application:   public static EntityMetadata[] GetEntities(IOrganizationService organizationService)         {             Dictionary attributesData = new Dictionary ();             RetrieveAllEntitiesRequest metaDataRequest = new RetrieveAllEntitiesRequest();             RetrieveAllEntitiesResponse metaDataResponse = new RetrieveAllEntitiesResponse();             metaDataRequest.EntityFilters = EntityFilters.Entity;             // Execute the request.             metaDataResponse = (RetrieveAllEntitiesResponse)organizationService.Execute(metaDataRequest);             var entities = metaDataResponse.EntityMetadata;             return entitie...

How to update related entity records in Dynamics CRM using javascript

In this blog, I am going to show how we can update a related entity record through JScript in DYnamics CRM either REST or OData way. First of all I'll show update data using REST Query in Method 1 and then using OData query in method 2. function btnUpdateOnClick() {     try {         var selectedRows = Xrm.Page.getControl("SubGridName").getGrid().getSelectedRows();         selectedRows.forEach(function (selectedRow, i) {             var s = selectedRow.getData().getEntity().getEntityReference();             var selectedRowGuid = s.id;             var selectedRowName = s.name;             var selectedRowEntityName = s.entityType;             UpdateAccount(selectedRowGuid, selectedRowName, selectedRowEntityName);         });     }   ...

Expand and Collapse feature in PowerApps

Write the following on APP Start Code: Clear(colTreeElement);    ForAll(    TreeViewElement,    Collect(      colTreeElement,      {        ElmntName: Switch(          'Element Name',          "India",          Concatenate(            "India",            "                                     ",            "Score:4"          ),          "United States",          Concatenate(            "United States",            "                     ...

How to Set field values in CRM through parameters passed to a new form using JavaScript

Image
In this blog I am showing how we can add default values to the new form when open new form. You can set default values for new records created by users by specifying attribute values in the URL that is used to open the form. For this you need to add a Button placed on the form(Existing Record) and on click of this button we'll copy data to the new form from the existing record. In this example I placed a button of account entity form which is enable only if record exists and on click of this a new form opens with few values copied to new form using parameter passed in URL. Add code as shown below function GetIdFromLookup(lkpFieldSchemaName) {     var lkpField = null;     var sGuid = null;     lkpField = Xrm.Page.data.entity.attributes.get(lkpFieldSchemaName);     if (lkpField != null && lkpField.getValue() != null)         sGuid = lkpField.getValue()[0].id;     return sGuid; } function ...

How to generate PDF/ xls report from .rdlc without using Reporting services in c#.

In this blog, I am going to show how to create a Report dynamically using a DataSet in Report document (*.rdlc). and show the report without much effort. Step 1: Create a Report(.rldc) using SSRS or any other tool. Add appropriate  DataSet and DataSource and with required columns create a table and Bind DataColumns. Once Report created build and Goto Code behind solution. Step 2: Now in the Code behind, add the following codes and required references. Note: I have added just 3 fields report and the same field should be used in code behind also with exact DataSet name as it is in Report. Currently DataSet has hardcode value which you can replace with fetched value from Database. using System.Collections.Generic; using Microsoft.Reporting.WebForms;         #region ReportGenerateFromRDLFile         public static void RenderReport()         {             string sReportPath ...
go to top image