Posts

Showing posts from August, 2018

Get Status Reasons (statuscode) for a specific status (Statecode) from metaData

Following is sample code for getting statuses for an entity from metadata function getStatusAttributeMetadata(entityName) { var data = null; var webApiQuery = Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='" + entityName + "')/Attributes/Microsoft.Dynamics.CRM.StatusAttributeMetadata?$expand=OptionSet"; var req = new XMLHttpRequest(); req.open('GET', webApiQuery, false); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.send(); if (req.readyState == 4 /* complete */) { if (req.status == 200) { var results = JSON.parse(req.response); data = results.value[0]; } else { var error = JSON.parse(req.response).error; console.log(error.message); ...

Enable Tracing for Dynamics CRM on premises

By Enabling tracing, there created some files that monitor the actions that are performed by Microsoft CRM. These files are helpful when you need to troubleshoot error messages as we can find more information about the issues/errors. We can enable tracing for dynamics CRM on premises by adding some registry keys on CRM server. However, m ake sure to follow followi ng steps carefully, as there might occur serious problems whe n you modify regis try incorrectly. 1.      Go to CRM server Open registry (run à regedit) 2.      HKEY_LOCAL_MACHINE à Software à Microsoft à MSCRM à add new keys a.      Name: TraceEnabled Type: DWORD Value: 1 b.      Name: TraceDirectory Type: String Value: C:\CRMTrace c.      Name: TraceRefresh Type: DWORD Value: 99 3.      Create the folder "CRMTrace" in C directory 4.      Reset ...

Auto Complete in Dynamics CRM

Image
Following is sample JavaScript code to demonstrate the auto completion feature. This sample configures the auto-complete feature for a custom single line of text that auto complete years. Call following function on form load event, this will auto populate the last 60 years in the field when do keypress on this field. function year_AutoComplete() { var keyPressFcn = function (ext) { try { resultSet = { results: new Array() }; var dt = new Date(); for (i = 0; i < 50; i++) { resultSet.results.push({ id: i, fields: [dt.getFullYear() - i] }); } if (resultSet.results.length > 0) { ext.getEventSource().showAutoComplete(resultSet); } else { ext.getEventSour...