The Microsoft Dynamics CRM Blog
News and views from the Microsoft Dynamics CRM Team

Microsoft Dynamics CRM 2011 Custom Code Validation Tool Released

Microsoft Dynamics CRM 2011 Custom Code Validation Tool Released

  • Comments 5

Download: Microsoft Dynamics CRM 2011 Custom Code Validation Tool

The purpose of this tool is to assist customers and partners of Microsoft Dynamics CRM identify potential issues with their custom JavaScript in JavaScript libraries and HTML web resources.  The Microsoft Dynamics CRM Q4 2012 Service Update will include significant changes in the web application in order to be able to support a variety of browsers such as Safari, Chrome, and Firefox.  When using JavaScript code in Dynamics CRM, it is possible that some code will stop working or cause an error when you upgrade. For more information see Resolve Breaking Script Issues When Upgrading to the Next Release of Microsoft Dynamics CRM.

This post includes details about:

Problem Areas

There are two main problem areas when JavaScript customizations are upgraded to the Microsoft Dynamics CRM Q4 2012 Service Update.

  • Red Group’: Existing JavaScript uses unsupported internal functions that were removed as part of the cross browser work. Many Microsoft CRM functions used techniques that were only possible using Internet Explorer.  All supported public functions were preserved but many undocumented internal functions and properties were changed and are no longer available, even when using Internet Explorer.
  • Blue Group’: Existing JavaScript was written and tested only on Internet Explorer. It may not work correctly for other browsers. Code using the deprecated crmForm object from earlier versions of Microsoft CRM will not work for browsers other than Internet Explorer. Organizations using other browsers must upgrade their code to use the Xrm.Page object introduced for Microsoft Dynamics CRM 2011.

Note: After your Microsoft Dynamics CRM Online organization has been upgraded to the December 2012 Service update, if you have any issues caused by code in the Blue Group you may be able to address them by changing the HTML Component Support setting found in the System Settings Customization tab. Check the Include HTC support in Microsoft Dynamics CRM forms checkbox. As long as your form scripts have dependencies on these HTC components they must continue using Internet Explorer version 9 or lower. Internet Explorer 10 does not support HTC components. For more information see Use JavaScript with Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online : Write JavaScript for Multiple Browsers

The tool examines each custom JavaScript and HTML web resource in the organization that the tool is installed in. Each web resource is displayed in a list box at the top of the tool form.  Clicking each web resource will show the issues that are found with the JavaScript that is part of that web resource as shown in Figure 1 Custom Code Validation Tool UI.

Figure 1 Custom Code Validation Tool UI

  • Code that matches patterns for the Red Group is highlighted in red.
  • Code that matches patterns for the Blue Group is highlighted in blue.
  • The tool also provides a count of the number of occurrences of each JavaScript function or property that has been identified as a potential issue.

Red Group Issues

Red Group issues need to be addressed in order for users to be able to use the application as they had done previously.  These issues affect all browsers.
The following Table 1 : Red Group matching patterns contains the internal, unsupported JavaScript functions and properties that were available in previous versions of Microsoft Dynamics CRM. 

Table 1 : Red Group matching patterns

‘crmGrid’

.ShowAppNav

.IsValid()

.SubmitCrmForm

.IsReadyToClose

.detachCloseAlert

.RunReport

.Print

.BuildXml

.BuildXmlToSubmitForm

.SetFieldReqLevel

.SetAllFieldsToNonReqLevel

.displayMissingValue

.GetLabelControl

.FireSaveEvent

.HideField

.VerifyFieldIsSet

.SetDeferredCmdId

.CheckFormDirty

.CloseAlertAttached

.SetViewportTabSection

.ModifyMinimumTabHeight

.GetXml

.ParseXml

.RaiseOnChange

.CreateInnerSlug

.ResetToDefault

.ResetDefault

.FormatDuration

.AddDependentParameters

.AddParam

.AddBindingColumn

.getLookupField

.Clear

.Lookup

.AddItems

.Items

.RemoveItem

.UpdateItem

.IsPermissibleType

.RaiseOnAfterSelectEvent

.RaiseOnChangeEvent

.RaiseSetAdditionalParamsEvent

.AreValuesDifferent

.RefreshLookupItemImage

.GetLookupTypeIcon

.attachEventHandler

.GetDataXml

.SetCurrency

.InitializeLookupPresence

.QueryLookupPresence

.SetTime

.AddOptionGroup

.InsertSlugControl

.UpdateOperatorControl

.UpdateInnerHtml

.DeleteDataSlug

.CurrentOperatorIsClear

.CalculateDataSlugTabIndex

.refreshTimeValue

.attachAsOnlyHandler

.GetLookupControl

.DefaultValue

 

 

 

Blue Group Issues

The following Table 2: Blue Group matching patterns identifies the code that may not work for browsers other than Internet Explorer. Some of the elements are simply references to Microsoft technologies, such as ActiveXObject, which are not supported in other browsers.  Others are references to the Document Object Model, which may have changed as part of the CRM Q4 2012 Service Update, so customers and partners will want to investigate whether these references are still valid.

Table 2: Blue Group matching patterns

.htc

<msxsl:script

jscript

<xml

crmForm.all

document.selection

.createTextRange

onfocusout

onfocusin

onmouseleave

onmouseenter

style.textDecorationLineThrough

.insertCell(

.insertRow(

cursor:hand

.item[

.rules

.parentElement

.tags(

<script for=

::

.selectSingleNode

.selectNodes

.text

.xml

ActiveXObject

.attachevent

debugger

.additionalparams

.getElementById

window.location.href

.document.activeElement

event.cancelBubble

window.openPopup

.setFirstElementFocus(

.loadXml

.load(

.transformNode(

.childNodes.length

.hasChildNodes

.firstChild

.lastChild

.nextSibling

.previousSibling

.childNodes[

.contains(

.openStdDlg(

dblclick

oncontextmenu

.dir

.innerText

.outerHTML

.currentStyle

.styleFloat

opacity=

.isContentEditable

window.navigate

.srcElement

.returnValue

document.all

.createNode

document.appendChild

document.styleSheets(

rows(

cells(

document.forms(

options(

options.remove

.add(

.insertAdjacentElement

.insertAdjacentHTML

.Save(

.SaveAndClose(

.FormType

.ObjectTypeCode

.ObjectId

.ObjectTypeName

.RequiredLevel

.SetFocus(

.FireOnChange

.Min

.Max

.DataValue

.isDirty

.Disabled

.SelectedOption

.SelectedText

.SortingEnum

.Sort

.SelectedIndex

.InnerText

.OptionsXml

.Precision

.DataXml

.Text

.Value

.DisplayValue

.WillSubmit

.DataChangeHandler

.BypassValidation

.AllowFormFocus

._bSaving

._htcInitCompleted

.SubmitFormId

.NO_DATA

.RefreshOnSave

.Visible

.ForceSubmit

.Form

.TimeControl

.isInitialized

.allowblankdate

.IsMoney

.IsBaseCurrency

.CurrencySymbol

.CurrencyPrecision

.IgnoreCurrencySymbol

.IgnoreRange

.PrecisionChangeHandler

.TrimValue

.MaxLength

Enumerator

 

 

 

False Positives 

This tool will identify some false positives in the JavaScript.  Any of the functions or properties listed in the tables mentioned previously that is part of commented code will be identified in the Results text box.  These can be safely ignored as the code is commented out and cannot be executed.

The tool also cannot determine the intent of the script being analyzed.  This means that it cannot determine whether the script will function correctly if it needs to interact with other custom JavaScript functions.  For example when performing feature detection it is common to detect whether a particular feature is available in the current browser and route the logic to use different code depending on the browser. In this case, code that only works for Internet Explorer would exist and does not represent a problem.

Every effort was made to identify those functions and properties being used in custom JavaScript and HTML web resources that may affect customers and partners.  The list is as comprehensive as possible, but there may be other issues that this tool does not identify that could affect the functionality of the existing customizations.  The tool should not replace standard testing practices to ensure the customizations continue to work once the CRM Q4 2012 Service Update is applied.

Microsoft Dynamics CRM 2011 Custom Code Validation Tool Setup

Download: Microsoft Dynamics CRM 2011 Custom Code Validation Tool

The tool is provided as a managed solution which can be imported into any Microsoft Dynamics CRM 2011 organization.  You must have the Import Customizations Privilege to install the solution. Users with the System Administrator or System Customizer security role typically have this privilege. To install the solution, follow these steps.

  1. Launch Microsoft Dynamics CRM using Internet Explorer with a user account that has privileges to import solutions.
  2. Log into the Microsoft Dynamics CRM organization into which you want to install the solution.
  3. Click the Settings area in the left hand navigation pane in Microsoft Dynamics CRM 2011.
  4. Click the Solutions navigation item under the Customizations sub-area in the left hand navigation pane.
  5. Click the Import button on the toolbar for the All Solutions grid view.
  6. Click the Browse button and select the folder where the CustomCodeValidationToolForMicrosoftDynamicsCRM201_1_0_0_0_managed.zip file is located.
  7. Click the Next button and proceed to import the solution.
  8. Once the import completes, click the Close button to close the Import Solution dialog.
  9. Click the Publish All Customizations toolbar button on the All Solutions grid view to publish the solution.
  10. To launch the tool, double click on the CustomCodeValidationTool solution to open it.
  11. Click the Open the Custom Code Validation Tool button on the solution’s Configuration Page to launch the tool.

 

  • Hi,

    Is there any resource or white paper that will help us resolve issues in BLUE GROUP area?

  • Gday,

    We're currently trying to use this to check our scripts for issues before upgrading to the latest Polaris update, but are having trouble getting it to run.  It shows a loading percentage for a split second and then... nothing.  No error message or anything that would provide insight, just a blank page.  I've looked up a few proposed solutions regarding changing language and checking the WebResourceBase table for records with NULL Content values, but neither has helped.  I've also tried running it on another CRM instance and also on co-worker's computers, to no avail.  What else can I do to figure out why this tool isn't working?

    Thanks,

    Matt W

  • I downloaded this tool this morning and it will not work. I installed silverlight and all I get is a blank screen. I also found the proposed solution regarding WebResources and ours did not have any nulls in it so this solution did not work for us.  Are there any other solutions to get this tool to work?

  • same issue as KimB2009, it seems silverlight crash some how. anyone knows the cause and fix. thanks.

  • Hi, I was also facing the same issue as Matt Wanchap was facing.

    To resolve this, I checked all my javascript web resource and found there was 2 web resource with no code. I just deleted the empty javascript web resources and then ran the tool. Then it worked for me.

    Hope this helps..!!

Page 1 of 1 (5 items)
Leave a Comment
  • Please add 1 and 6 and type the answer here:
  • Post