As often happens, I was contemplating a blog post on a topic only to see that Scott had already written it.

In this case it’s the new Salesforce.com Autocomplete Lookups code. The functionality is cool–it turns the standard lookup popups into type-ahead lookups. But more interesting is the way it is implemented.

Salesforce.com could have released this with Winter ’07. They could have added a configuration setting in the Admin side of the app that would allow you to turn Autocomplete on or off in your database. That’s how they have release changes to the UI–look at related list hover menus, for example.

But they took a different tack here, and exploited a hack that has been available for awhile, but became more useful in Winter ’07. One the home page of your Salesforce.com instance, you can put arbitrary text, and the Salesforce Heretic showed how you could put code blocks in here and make things happen in Salesforce.com.

In Winter ’07, they made it so you could have that code execute on every page in Salesforce.com, not just the home page. So when they wanted to release the Autocomplete feature, they wrote a big code block using the dojo AJAX toiolkit and made it easy for you to drop it into the special place where it will execute on every page.

It’s an interesting angle, but not a really sustainable one. There’s only one place to drop this kind of code, so if you were trying to do auto complete and some other stuff, it would all have to coexist. But it begs for a more formal way to do this kind of “greasemonkeying” to the Salesforce.com UI. Maybe the release of Autocomplete is an indicator that they’re heading this way.