Help

Can I use a script to generate a customer ID

Topic Labels: Scripting
272 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Mike_Ball
6 - Interface Innovator
6 - Interface Innovator

Hello

I have a requirement where I want to create a Unique Customer ID based on their name and an incremented number

For example:
I add a new customer "XYZ (North)" and want to generate the Customer ID XYZ001
Then I add another New customer "XYZ (South)" and want to generate the Customer ID XYZ002

ID would just increment for each 3 character prefix.  I have no problem with having another table to trank the highest used number for XYZ if needed 

Fields would be "Customer Name" and "Customer ID"

TIA
Mike

4 Replies 4

Yes this is possible with a script. It is also possible without a script.

Given the two examples you have, it looks like each customer is a combination of a parent company and a location. You want the name of the parent company and an increment number. In the table of parent companies, have a field with the {Highest Number}. Have a formula field for the {Next Number} that adds one to this number. 

When there is a record for a new location of the parent company, have an automation create the {Unique Customer ID} by copying over the name of the parent company and the {Next Number} to the new location record. Also copy over the {Next Number} to the {Highest Number} in the parent company record.

If you create new location records faster than the automation can run, you may have problems with multiple locations getting the same increment number, but that is an issue with automation speed and would apply to any system based on automations.

Thank you for taking the time to reply @kuovonne 

I think I follow and will try it out. The companies are not necessarily related. Maybe a bad example.

Could have "British Automotive Limited" and "British Construction", nothing to do with each other just begin with "British".  So automotive would be BRI001, Construction BRI002 and a third organisation of "Bright Windows" would be BRI003

Would that still work on your design?

Thanks again
Mike


So you want to take the first three letters of the company name? This could still be done with automations, but it would require either multiple automations (to account for creating the records with the first three letters of the company name), or scripting, or a third party automation service.

On the other hand, I generally do not find unique record ids created with this format to be worth the hassle. 

Mike_Ball
6 - Interface Innovator
6 - Interface Innovator

Agree but customer requirement (long story).  Easy isn SQLServer.  Thanks for the pointers