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 🙂

Advertisements

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 change event.

//Force Refresh WebResource
function refreshWebResArea()
{
 var webResourceControl = Xrm.Page.getControl("WebResource_balu");
 var src = webResourceControl.getSrc();
 webResourceControl.setSrc(null);
 webResourceControl.setSrc(src);
}

That’s It. Enjoy 🙂