Pogo69's Blog

July 2, 2012

CRM 2011 – Custom Code Validation Tool – UR9 (AKA R8) Preparation

Filed under: Cutting Code — pogo69 [Pat Janes] @ 15:51

Introduction

I’m making this post in an effort to hopefully alleviate my fellow CRM Developer’s concerns over the output from the recently released ‘Microsoft Dynamics CRM 2011 Custom Code Validation Tool’:

http://www.microsoft.com/en-us/download/details.aspx?id=30151

I participated in a posting on this forum last week:

http://social.msdn.microsoft.com/Forums/en-US/crmdevelopment/thread/3bdd0926-b66f-4c69-9e5c-bd43e400bf08

wherein the Tool picked up code that was tagged as “creating problems in browsers other than IE”.  The offending code is as follows:

Xrm.Page.getAttribute("attributeName").getSelectedOption().text

which is supported via the published Xrm.Page object model documented in the CRM SDK.

False Positives

I thought it odd that supported code would be deprecated in the upcoming Rollup, regardless of the browser.  After seeing the Code Validation Tool in action (and decompiling it so that I knew exactly what it was doing), I am convinced that this, and possibly MANY other such instances of coding violations will be “false positives” – that is, such code will be flagged as potentially unsupported, but will in fact, continue to work on ALL browsers.

The release notes for the tool mention the possibility of such “false positives” but I think the impact of such may be missed by many users.

How the Tool Works

The Tool contains a list of “offending” code phrases; amongst which are snippets such as:

.Text
.InnerText
.Value
.selectSingleNode("...")

The tool uses these phrases to perform string pattern matching on your code.  If it finds a match, the code is highlighted as “offending”.

Obviously, if your code is using .Value or .Text to interrogate and/or manipulate the DOM of a CRM Form, it is unsupported and should quite correctly be flagged as such.  However, the tool cannot interrogate the semantics of your code – merely the syntax.  If, for instance, you are using .Value to build a Money attribute for the purposes of submission via OData/REST; or if you use .selectSingleNode() to process the results of a SOAP query, your code is still supported, but will be flagged otherwise.

As such, I’m reasonably certain that the instance in the link above remains valid and was merely a “false positive”.

Conclusion

If you’re in the habit of using unsupported code mechanisms use the Tool and find out where you will almost certainly have to make changes.  But use with caution and make sure that you don’t end up fixing things that weren’t broken.

Advertisements

1 Comment »

  1. […] CRM 2011 – Custom Code Validation Tool – UR9 (AKA R8) Preparation […]

    Pingback by Did You Know, Dynamics CRM & xRM #17 « North52 — July 18, 2012 @ 03:18


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: