Adding a customer field to a UI: Proposed solution

In yesterday’s post, I described a UI problem I was thinking about. Namely, how can you add a customer field to a UI. That post contains the criteria I’m looking for which I won’t repeat here because this sucker’s already longer than I want it to be.

I was going to let the thing germinate a little first but Ayende was kind enough to propose the exact solution I am considering in the comments. That is, the customer name field will be an auto-complete textbox, like Google Suggest. As the user types, it populates the listbox portion with search results based on what the user has entered. If the user selects one of those values, the other customer info textboxes get populated with the default values. The user is free to change them.

I’ll walk through a couple of scenarios. First, adding a job with an existing customer. We go to the customer name field and start typing. The list of search results pops up and we select one of them. This brings back the default contact info for the customer and populates other contact fields on the form as well as a hidden field with the customer ID. The user is free to change the contact details if the defaults aren’t appropriate.

When the job is saved, we create a link ‘twixt the job and the customer based on the customer ID field we stored. But we save the contact data with the job (not with the customer), even if the user didn’t change it from the defaults. The reason being: In the future, the default contact person may change but that doesn’t change the fact that, for this job at this time, this is the contact person.

Next scenario: adding a new customer. Again we go to the customer name field on the job page and type a name into the auto-complete textbox. It auto-populates with search values but we don’t select any of them. We continue on adding the contact information for this job.

When the job is saved, it recognizes that we didn’t select an existing customer because the customer ID field is blank. So we create a new customer record in the database and provide it with the entered contact info as default values. The remainder of the process is the same as if we selected an existing customer, including copying the "default" values into the job record.

Another requirement was that we wanted to update the customer with new default information if we so desired. This can be done with a checkbox. If checked, we update the customer record with the user-entered contact info before saving the job. Everything else in the process is the same.

I can think of a couple of edge cases that may require some tinkering. Firstly, customers with the same name. The business deals with both individuals as well as companies and it’s conceivable that they could have a couple of John Smiths (or more likely, given the area, John Kowalchuks) on their mailing list.

Not sure how I’ll deal with that or even if I’ll address it. This isn’t a customer management app after all. They just want some reports on where most of their business is going. This edge case doesn’t sound like one that will skew the results one way or the other.

Next edge case: The user misspells the customer name and mistakenly adds a new customer when they already exist. This falls under my personal adage of "You can’t save everybody" and again, I don’t believe this will have a statistical bearing on the results. Besides which, it’s nothing an annual data clean-up can’t handle.

Next: What if the user selects a value from the auto-complete list, then decides it isn’t appropriate and deletes it, choosing to enter a new customer instead? I won’t go into details here mostly because I don’t know them yet. Off the top of my head, this will involve some funky AJAX to ensure that the customer ID field is blank when the job is saved.

Lastly: what if the user entered in the wrong customer, saved the job, then later wants to change it? Do we even allow that on the job entry screen? Or is that something an administrator should do in a separate process?

Sounds like a question for the client to me but historically, the person entering the data *is* the administrator so my guess is to make it as easy as possible. Which means having the ability to change the customer for a job at any time.

Final note: I don’t intend for this to be the sum total of the customer management capabilities of this application. I still plan to have the ability to update customer information outside of the context of a job.

But the job entry screen is where they will spend a good chunk of their time and it behooves me to make it flow as effortlessly as possible. Their business isn’t in data entry and data capture. It’s land surveying. My business is to make sure that this application works as seamlessly as possible so that they can focus on the tasks that actually make money for them (and don’t ask me what those are because, despite my genetic leanings, I have little idea what land surveyors actually do).

In short, I don’t want to be the bottleneck in their process.

Kyle the Averse

This entry was posted in Conscientious Coding, User Interface. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Kyle Baley


    In many cases, the company name is irrelevant. They do surveys for individuals buying or selling a house so if that person calls back, they wouldn’t say John Kowalchuk from Moonshiner’s Paradise. Just Johnny K.

    But it’s an edge case that I don’t think is worth handling unless you’re obsessive compulsive. Individuals make up maybe a third of their clientele. Individuals that share a name much less. And individuals that share a name and do repeat business with them on a regular basis…well, let’s just say that even with the cut rate I’m charging, it’s still a little high on the cost/benefit scale.

  • alwink

    “The business deals with both individuals as well as companies and it’s conceivable that they could have a couple of John Smiths (or more likely, given the area, John Kowalchuks) on their mailing list.”

    You could put the company name behind the customer in the suggest drop down:
    John Kowalchuks (Initrode corp.)
    John Kowalchuks (Pmt Europe)
    Maybe people can then also type in a part of the company name if they forgot what the name of the customer was.

  • Kyle Baley


    Nice counter-example. In my requirements, I covered the scenario that if a default contact changes, the original person is still an employee at the company so we don’t want to update existing open or closed jobs. In your example, we may even want to update closed jobs because if we ever wanted to contact MsJones about a previous job, we wouldn’t be able to.

    For this particular case, my answer won’t be helpful because the clientele isn’t big enough for this to be a concern. A SQL statement or two directly against the database will be how I handle it on an as-requested basis.

    For something more substantial, off the top of my head, I’d make this a function of the customer management section. At the bottom, I mentioned I’ll still have a customer screen to update customers outside the context of a job. I’d likely put in an option to update all open jobs with the new contact info if it was changed. Getting even fancier, I’d update it for a job only if the existing contact for the job matched the previous default.

  • Scott Bussinger

    I’m curious — how would you handle a slightly different requirement where the user can override the contact information for a job, but if not overridden it should track changes made in the customer record?

    To illustrate, let’s say the MsJones is the default contact person for customer BigCorp. On a job, the user could leave MsJones or override it with MrSmith. But let’s assume for now they leave it as MsJones. MsJones quits and is replaced by MsBaker and the BigCorp customer record is updated accordingly. Open jobs whose contact information hadn’t been overridden should now reflect MsBaker as the contact person.

    I’ve seen this sort of thing handled a few different ways, but I never really liked any of them. Any thoughts on how the UI could best handle this?