Experiences on CRM, .Net and DHTML

CrmXpress

  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

After migrating CRM 4.0 to CRM 2011, CRM is throwing an exception : A potentially dangerous Request.Form value was detected from the client

I recently observed a scenario where a CRM 4.0 database was upgreaded to CRM 2011 and after upgrade process uses were not able to perform any kind of operation within CRM. The exception that we found was :

A potentially dangerous Request.Form value was detected from the client (crmFormSubmitXml="<iteasy_postcode><it...").;Hash='1073421037'

This is because ASP.Net 4.0 now has a different behvaior and it inspects all request data. Rather that being the cookies, urls, headers, etc. This behavior is controlled by RequestValidationMode property.
Now to override this behavior for CRM 2011, all you need to do is set <httpRuntime requestValidationMode="2.0" /> in your web.config. This setting will enforce request validation in .Net 2.0 mode i.e. only Form's input fields are checked for invalid HTML input.

CRM 2011 and Application File Privilege

Recently I was asked what exactly Application File Privilege found under Core Records affects within CRM. After some research on the topic I found that it holds Schemas and Templates as mentioned below :

CRM 2011 Application File Privilege

RibbonCore
AdHocReportTemplate
RibbonWss
FormXml
RibbonTypes
SpreadsheetMLTemplate

One of the practical usages of AdHocReportTemplate is to apply changes to your Ad Hoc Reports by modifying this template. Here is a link that demonstrates how to do so : http://blog.sonomapartners.com/2008/11/customizing-the-report-wizard-template.html

CRM 2011 Exception : The key specified to compute a hash value is expired, only active keys are valid

This one is a well known error for people who have worked with CRM 4.0 and an easy fix was to restart CRM Async Service.

The key specified to compute a hash value is expired, only active keys are valid. Expired Key : CrmKey(Id:a06a2c71-e96a-e011-ae0c-000c29ce8648, ScaleGroupId:00000000-0000-0000-0000-000000000000, KeyType:CrmStaticVersionScaleGroupKey, Expired:True, ValidOn:04/20/2011 00:59:35, ExpiresOn:06/19/2011 00:59:35, CreatedOn:04/20/2011 00:59:35, CreatedBy:CRM\Administrator.

The same error when it comes to CRM 2011, you might have to restart

Microsoft Dynamics CRM Asynchronous Processing Service 
Microsoft Dynamics CRM Asynchronous Processing Service (maintenance)

followed by an IIS Reset.

CRM 2011 Multiple Sub-Grid OnLoad Fix

I was recently working with a client where I had to come up with a multi-grid form for Case entity and wanted to display related activities in each grid. And they wanted to display around 6 different types of activities to be available on Case form.

After adding the sub-grids I came to notice a strange issue and as such it does make sense to load records as and when we need them, that is not what my client wanted. Basically what was happening is after I added the sub-grids, only first 4 grids will load the data when form is loaded. Fifth grid onwards I will get a link which will ask me to click on it if I need to see records. This is in fact a good solution to avoid loading unnecessary data and improve performance, client was not happy with that solution. And I was asked to come up with a workaround, it is pretty simple trick as such but can come really handy. You might want to polish it a bit like- make sure that you don't click on any other link except the one within the grids and maybe some more checks just in case there are other elements with the same class id.

All you need to do is to include this script, on OnLoad of the form along with the jQuery minified library[which you will have to add and make it available on your form.]

function CrmXpress.Scripts.UI.SubGridLoadFix() { 
  
    $(document).ready(function () { 
  
        var links = $("a.ms-crm-List-LoadOnDemand") 
        for (i = 0; i <= links.length; i++) { 
            try { 
                links[i].click(); 
            } 
            catch (e) { 
                // Handle for other errors, or safely ignore 
            } 
        } 
    } 
); 
}

Have fun and Happy Coding.