Mariano Gomez has a great look at code to auto generate Customer IDs.
Auto Generating Customer IDs in Dynamics GP
Archived post from 2010. Dynamics GP and the links it points to have changed since; check current documentation before relying on version-specific steps.