Posts

Showing posts from October, 2010

CRM 4.0: Overriding lookup onclick

Image
For one of my customer, I faced a difficulty. I wanted to override the lookup onclick event to provide my own lookup selection that uses a treeview (see below picture) which is much mor euser friendly when we talk about self related entities. The problem : the behavior of the lookup is controled by a .htc file. It is a bad idea to change this kind of file (unsupported) and you can’t just remove the link to this file in the css class because you will loose all behaviors, not just onclick one. The only way I found was to create a new lookup image with its own behavior, hide the original one, and add the new image next to the original one. All this using javascript. It is also unsupported but you are sure that your javascript won’t be override during rollup installation or other kind of CRM updates. Here is the javascript: 1: var lookupAttribute = "new_categoryid" ; 2:   3: crmForm.performNewClick = function () 4: { 5: // Put here your alternative