Darren Lewis bio photo

Darren Lewis

Professional Nerd

Twitter GitHub StackOverflow
Published: May 18, 2012

If you’re on Rollup 6 or higher you can ignore this post.

I came across a problem today when loading a record using the URL addressable form feature as documented over on the Microsoft site here. The record would load fine but when I tried saved the record the page wouldn’t refresh correctly. I would end up with a disabled ribbon and no other page content! The save operation was however succeeding.

I traced this down to an exception being thrown from within the platform JavaScript code. It was making the assumption that the querystring value extraqs was available and calling string.startsWith()which was throwing the null exception.

If you take a look at the URL for any entity loaded via a hyperlink in CRM they all contain this parameter which is typically used to pass attribute values to a form so those values can be pre-populated on load. The value of this parameter must be URL encoded.

Here’s a contact loaded from the default Homepage grid:

http://server/org/main.aspx?etc=2&extraqs=%3f_gridType%3d2%26etc%3d2%26id%3d%257b0F837B6D-249A-E111-902A-000C2945F65C%257d%26rskey%3d667293691&pagetype=entityrecord

Here’s the sample URL provided for loading an account on the MSDN article linked above:

http://myorg.crm.dynamics.com/main.aspx?etn=account&pagetype=entityrecord&id=%7B91330924-802A-4B0D-A900-34FD9D790829%7D

Switching out the values in blue for environment specific values you’ll see that the record will load correctly. However, if you then make a change and click save the page will hang as show below.

 

Reformatting the sample URL as follows (bolded) will fix the issue when saving the record.

http://myorg.crm.dynamics.com/main.aspx?etn=account&pagetype=entityrecord&id=%7B91330924-802A-4B0D-A900-34FD9D790829%7D&extraqs=anyvalueyoulikeorempty