Blog & News

Articles, insights and thinking from software development vendor

Custom code validation tool for Microsoft Dynamics CRM 2011 and 2013

The code retrieves all web resources and then each line of the code is analyzed against a predefined set of patterns (regular expressions).

The list of patterns specific for IE

.htc .childNodes[ .Sort .setFirstElementFocus(
<msxsl:script .contains( .SelectedIndex .loadXml
jscript .openStdDlg( .InnerText .load(
<xml dblclick .OptionsXml .transformNode(
crmForm.all oncontextmenu .Precision .childNodes.length
document.selection .dir .DataXml .hasChildNodes
.createTextRange .innerText .Text .firstChild
onfocusout .outerHTML .Value .lastChild
onfocusin .currentStyle .DisplayValue .nextSibling
onmouseleave .styleFloat .WillSubmit .previousSibling
onmouseenter opacity= .DataChangeHandler .SetFocus(
style.textDecorationLineThrough .isContentEditable .BypassValidation .FireOnChange
document.appendChild window.navigate .AllowFormFocus .Min
.insertRow( .srcElement ._bSaving .Max
cursor:hand .returnValue ._htcInitCompleted .DataValue
.item[ document.all .SubmitFormId .isDirty
.rules .createNode .NO_DATA .Disabled
.parentElement .insertCell( .RefreshOnSave .SelectedOption
.tags( document.styleSheets( .Visible .SelectedText
<script for= rows( .ForceSubmit .SortingEnum
:: cells( .Form event.cancelBubble
.selectSingleNode document.forms( .TimeControl window.openPopup
.selectNodes options( .isInitialized .ObjectTypeName
.document.activeElement options.remove .allowblankdate .RequiredLevel
.xml .add( .IsMoney .MaxLength
ActiveXObject .insertAdjacentElement .IsBaseCurrency Enumerator
.attachevent .insertAdjacentHTML .CurrencySymbol .ObjectId
debugger .Save( .CurrencyPrecision .TrimValue
.additionalparams .SaveAndClose( .IgnoreCurrencySymbol .text
.getElementById .FormType .IgnoreRange  
window.location.href .ObjectTypeCode .PrecisionChangeHandler  

The list of patterns specific for old CRM API form

‘crmGrid’ .InitializeLookupPresence .Clear
.ShowAppNav .QueryLookupPresence .Lookup
.IsValid() .SetTime .AddItems
.SubmitCrmForm .AddOptionGroup .Items
.IsReadyToClose .InsertSlugControl ORG_UNIQUE_NAME
.detachCloseAlert .UpdateOperatorControl ORG_LANGUAGE_CODE
.BuildXmlToSubmitForm .UpdateInnerHtml SERVER_URL
.SetFieldReqLevel .DeleteDataSlug USER_LANGUAGE_CODE
.SetAllFieldsToNonReqLevel .CurrentOperatorIsClear .DefaultValue
.displayMissingValue .CalculateDataSlugTabIndex crmForm.all
.ModifyMinimumTabHeight .refreshTimeValue .DataValue
.GetXml .attachAsOnlyHandler .SetFocus()
.ParseXml .GetLookupControl .FireOnChange()
.RaiseOnChange .RequiredLevel .IsDirty()
.CreateInnerSlug crmForm.Save() .ForceSubmit
.ResetToDefault crmForm.SaveAndClose() .Disabled
.ResetDefault .FormType .GetLabelControl
.FormatDuration .ObjectId .FireSaveEvent
.AddDependentParameters .ObjectTypeName .HideField
.AddParam .ObjectTypeCode .VerifyFieldIsSet
.AddBindingColumn IsOnline() .SetDeferredCmdId
.getLookupField IsOutlookClient() .CheckFormDirty
.RemoveItem IsOutlookLaptopClient() .CloseAlertAttached
.UpdateItem IsOutlookWorkstationClient() .SetViewportTabSection
.IsPermissibleType GenerateAuthenticationHeader .RunReport
.RaiseOnAfterSelectEvent /mscrmservices/2007/crmservice.asmx .Print
.RaiseOnChangeEvent /mscrmservices/2007/metadatadataservice.asmx .BuildXml
.RaiseSetAdditionalParamsEvent .GetLookupTypeIcon .GetDataXml
.AreValuesDifferent .attachEventHandler .SetCurrency
.RefreshLookupItemImage    

The resources where matches are found are listed in the appropriate drop down lists
When a resource from the list is found, the web resource text is loaded and the issue is highlighted in Blue (for IE issue) and in Red (for all browsers / old api)

Below is the example of correct code validation:

Below is the example of correct code validation

However sometimes code validation tool can find errors where the code looks correct:

However sometimes code validation tool can find errors where the code looks correct

You can look at the post here on our website that provides a number of useful examples how to replace the code identified by the validation tool with the new one.

Order a phone call

Convenient time to call:

Cancel

Get in touch

Attach
Your file up to 30 mb
Cancel