Problem with unresponsive lookup field on CRM 2011 form

Recently had a minor problem with a form in CRM 2011 which I have resolved while trying to fix something else (isn’t that so often the way?).

Problem description / reproduction steps

I created a custom entity in CRM 2011 to use as a joining entity in a manual N:N relationship. In this scenario it was an “Attendance” record to link a Contact to an Event, and enable the business to track the status of the attendance (tentative, confirmed, attended, cancelled) along with relevant dates etc.

To reduce effort on the user’s part I made the primary “description” field on the record auto-filled based on the event and contact name, using jscript web resources. To observe sensible UI practice, I made sure the lookup fields came at the top of the form, then the description which was a result of those, so it should be obvious to the user what to fill in first, then by the time they get to the name field it is already filled in.

A blank new record form is shown below.

Attendance record blank screenshot

So, what went wrong?

When the user creates a new record, they expect to be able to get on with the job of typing in the fields. Although the Event or Contact was automatically filled in if they created the record from the context of the parent record to make life even easier, this still means that sometimes they needed to fill in one or the other field, and that’s where it got strange.

The Event field is first on the form, and you might naturally expect it to take focus when the form loads, ready for typing. No such luck. Even worse, it was not possible to click in this field and start typing to use recent items or wait for the record name to be resolved. Clicking where the mouse is pointing in the screenshot did nothing; the field behaved almost as if it was disabled. Except the lookup button itself was enabled and the user could click here, do a search and choose a record that way, albeit that takes longer.

Nothing I did or could think of would work, the field simply would not take focus at all. This was using IE9 and CRM Online – all latest stuff, surely that should work best?

So how did I fix it?

As it happens I had another bug with IE9. If I got impatient waiting for a form to load, or realised I had clicked in the wrong place and did not want to load the wrong things, I would usually just close the window before it finished loading. This turns out to be a great way to crash IE9 using CRM – if you close a form before it is fully loaded and rendered, it can kill you whole session, which is far from ideal when you have several windows open, especially in the middle of a batch of customisations.

So I logged that bug on the Connect website. And someone from MS helpfully replied with a possible fix, by changing a registry key for IE9, ironically designed to guard against the browser hanging (well, I guess crashing would tend to avoid a hang…)

So I applied the fix:

Create the following Registry Key Value to disable the Hang Resistance feature:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\
Type: REG_DWORD
Name: HangRecovery
Value: 0

and I still don’t know if it will stop IE9 crashing quite so much, but it sure has helped my ‘broken’ form to work properly. Now it takes the focus on the correct field when I click on it, and even opens the form with the focus already where it should be.

So I sorted it by trying to fix something else altogether. Typical. What’s the best thing you’ve ever managed to get working without actually knowing how?

About ukcrmguru
I'm an MVP for Dynamics CRM, consultant, Microsoft Certified Trainer and self-confessed geek. I also lead the UK CRM User group when I'm not too busy with all that.

2 Responses to Problem with unresponsive lookup field on CRM 2011 form

  1. Chris says:

    I’ve recently run into this issue and I don’t believe that it’s IE causing the issue.

    Upon further investigation of the form, for some reason, the input control has the disabled property set to true to which my workaround is:

    * check if that control id exists and
    * if it’s disabled then enabled it

    The following forum posts talks about the exact same issue, but I do not know if has been resolved in any of the latest Update Rollups:

    https://social.microsoft.com/Forums/is/crmdevelopment/thread/90cd8eea-de64-4df3-b696-8142cf7c5fc6

    In any case, a combination of checking in JavaScript + hiding a dummy field before the lookup might be a safe, redundant check.

    • Adam Vero says:

      Thanks for the feedback Chris. More food for thought.
      Another method that might work for my scenario (and possibly others) would be for me to put the “description” field at the top so it is the first field on the form and gets focus when the form loads. Then use a script to set the focus on the lookup field below it using Xrm.Page.getControl(strAttributeName).setFocus();
      A further option could be to make the “description” field disabled to force the second field to have focus, then when I use the onChange event on the lookup fields to fill in the description to make it enabled first, then disabled again afterwards.

Please feel free to join in the conversation below...

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

%d bloggers like this: