We had a client who had a unique ask. They needed a way to assigned serialized contract numbers for clients.
What they needed:
Contract numbers that increase by 1 for each new contract (ex: 001, 002, 003, etc).
Support for contracts for multiple countries that have different contract number prefixes.
How we fixed it:
Created a Country Contract prefix property that was filled via workflow depending on which country's sales pipeline was used.
Created a contract counter property that stored the contract number by itself
A contract number field (where we stored the final output)
A workflow with a custom code action that acts upon closed won deals. The code checks to see what the current highest number is for all contracts, then writes the new number by adding one to it.
Then the workflow takes the country prefix and the contract counter and hyphenates them together as the client required (ex: US-001, US-002, NL-001, NL-002, etc)
Figured I'd share this genearl setup here in case it's helpful to anyone!