The easiest way to do this is to set the export value of each list box item to the corresponding customer number. The script for the custom number field could then simply be:
// Set this field's value to the export value of the selected item in the list box
event.value = getField("customer_name").valueAsString;
Post again if you don't want to set up the list box that way for some reason since there are other ways to deal with this.