Set Server Url to OData Query Dynamically using JavaScripts in CRM 2011 Forms

Following statement can be used to retrieve accounts from the CRM application with the MyOrganization hosted in DevServer. http://DevServer/MyOrganisation/xrmservices/2011/OrganizationData.svc/AccountSet?$select=swmship_FirstName,swmship_Surname&$filter=startswith(Address1_City,'Ca') "http://DevServer/MyOrganisation/" part is varried according to the hosted server and the organization and it might raise errors when the above OData query get executed in some other CRM application. Following JavaScript can be used to get … Continue reading Set Server Url to OData Query Dynamically using JavaScripts in CRM 2011 Forms

Application Pool Recycling instead of Restarting IIS – CRM App Pool

Restarting or stopping IIS, or rebooting the Web server, is a server action. When restarting the Internet service, all sessions connected to the Web server (including Internet, FTP, SMTP, and NNTP) are dropped. Any data held in Web applications is lost. All Internet sites are unavailable until Internet services are restarted. For this reason, we … Continue reading Application Pool Recycling instead of Restarting IIS – CRM App Pool

Useful Javascripts for CRM 2011

// Get the form type GetFormType: function () { var FORM_TYPE_CREATE = 1; var FORM_TYPE_UPDATE = 2; var FORM_TYPE_READ_ONLY = 3; var FORM_TYPE_DISABLED = 4; var FORM_TYPE_QUICK_CREATE = 5; var FORM_TYPE_BULK_EDIT = 6; var formType = Xrm.Page.ui.getFormType(); if (formType == FORM_TYPE_CREATE) { alert("This record has not yet been created."); } else { alert("This record exists … Continue reading Useful Javascripts for CRM 2011

Microsoft Dynamics CRM 2011 – Hide Areas of a Form

// Toggle the Ribbon Toolbar to Show/Hide (same as clicking the show/hide Ribbon button) window.top.document.getElementById("minimizeribbon").fireEvent("onclick"); // Hide the Ribbon Toolbar and move the form Content area to the top of the window. window.top.document.getElementById("crmTopBar").style.display = "none"; window.top.document.getElementById("crmContentPanel").style.top = "0px"; // Move Form Content area up to top of window, initial style.top is 135px // Hide Left … Continue reading Microsoft Dynamics CRM 2011 – Hide Areas of a Form

Silverlight – Access UI from code Asynchronously

System.Windows.Threading Namespace provides classes that support the Silverlight threading system. Dispatcher Class provides services for managing the queue of work items for a thread. Dispatcher.BeginInvoke Method (Action) executes the specified delegate asynchronously on the thread the Dispatcher is associated with. E.g. Dispatcher.BeginInvoke(() => { MessageBox.Show("Member Number does not exist in the system."); this.memberNumberTextBox.Text = string.Empty; … Continue reading Silverlight – Access UI from code Asynchronously

Get the CRM server url from Silverlight [If the silverlight page is in a form]

private static String GetServerUrlFromCrmContext() { try { // If the Silverlight is in a form, this will get the server url ScriptObject xrm = (ScriptObject)HtmlPage.Window.GetProperty("Xrm"); if (xrm != null) { ScriptObject page = (ScriptObject)xrm.GetProperty("Page"); ScriptObject pageContext = (ScriptObject)page.GetProperty("context"); String serverUrl = (String)pageContext.Invoke("getServerUrl"); return serverUrl; } else { goto DevUrl; } } catch { goto DevUrl; … Continue reading Get the CRM server url from Silverlight [If the silverlight page is in a form]