UVM uses Numara Footprints to track client support tickets. When creating tickets from client submitted email, the application automatically fills out the contact information for the client, using their email to search against LDAP.
This search fails if the address from the incoming ticket is in the format email@example.com (as opposed to firstname.lastname@example.org). This results in a significant number of tickets coming into the system with only an email address in the contact field.
It seems the only way to fix this is by copying the uid, clearing out the rest of the fields, and searching by uid again. This needs to be done for every affected ticket.
Firebugs, Greasemonkies, and Mr. DOM
The next logical step was to encapsulate this into something that can be used outside of the development interface, and triggered automatically.
Enter the Greasemonkey. Greasemonkey is an extension for Mozilla Firefox that allows you to run custom scripts on pages that you are visiting. Think of Greasemonkey as a little mechanic that lives in your browser. It has a bunch of tools that it uses to alter or fix pages that you visit. These tools are known as Userscripts.
Turns out it’s pretty easy to write these Userscripts. Based on my spelunking in the DOM cave with Firebug, I slapped together a Userscript to fix my address book problem upon opening the ticket. Now when I load up the ticket editing interface, the contact information is automatically filled out — even if the ticket was created with an inconveniently formatted email address.
Lazyweb to the rescue
I was in a hurry, and didn’t feel like digging through my old code or writing new stuff to handle some of the grunt work that this tool needed. I borrowed a handy email address parser from Ben Nadel at Kinky Solutions, and a url parameter grabbing function from Netlobo.