Writing Logs into a Internal Storage Text File

Writing Logs into a Internal Storage Text File : //Write Log Files to Internal Storage Public void WriteLog(string messages) { String currentdate = DateTime.Now.Date.ToString("dd-MM-YY"); //Internal storage Path string path = string.Format(@"E:\CRMLOGS\{0}_log.txt", currentdate); if (!File.Exists(path)) { File.Create(path); } TextWriter writer = new StreamWriter(path); writer.WriteLine(messages); writer.Close(); } That's It. Enjoy 🙂

Refresh HTML WebResource in Ms CRM JS

Refresh HTML WebResource in Ms CRM JS  : Normally, When form loads, it will stores the data in cache and the data will be displayed in HTML Page. Based on Change Event or ON SAVE Event, it cannot refreshes the html. Below is the code to refresh the html page Forcefully after save or on … Continue reading Refresh HTML WebResource in Ms CRM JS

Alpha_ Numeric Character Validation In MS CRM JS

Alpha_ Numeric Character Validation In MS CRM JS : In this example, validation allows a field to accept only Alpha Numeric characters. // Alpha Numeric Validation function ValidateAlphaNumeric() { try { var field = Xrm.Page.getAttribute("fieldschemaname").getValue(); if (field != null && field != undefined) { debugger; var Result = Validatealphanumeric(field); if (Result == true) { Xrm.Page.getAttribute("fieldschemaname").setValue(field); … Continue reading Alpha_ Numeric Character Validation In MS CRM JS

Set Focus to a Particular field in MS CRM JS

Set Focus to a Particular Field : Based on some validations, setting focus to a particular filed or   You can also use this code on the page load if you want to set a default  start cursor on a Particular field. //Setting Focus to Particular Field. Xrm.Page.ui.controls.get("fieldschemaname").setFocus(); Dynamics 365 formContext.getControl("fieldschemaname").setFocus(); That's It. Enjoy :- )

Mobile Number Validation in MS CRM JS

Mobile Number Validation in MS CRM JS : In this example , Validates the format of a mobile phone number using a regular expression. It allows for 10 digit mobile Phone Number. //MObile Number Validation function MobileNumberOnChange() { try { debugger; var mobilenumber = Xrm.Page.getAttribute("mobileschemaname").getValue(); if (mobilenumber != null && mobilenumber != undefined) { debugger; … Continue reading Mobile Number Validation in MS CRM JS