Business Requirements:
Each customer should have one customer Id in particular format and unique so that It can be sync other systems. Some customers may not have customer Id. If user add any customer information and enter customer Id then enforce that the customer ID should include the 2-character billing country code, a dash, and an 8-digit number (for example, US-12345678). Each customer ID must be exactly 11 characters in length with zero spaces.
Solution:
1. Create a custom field on Account which is Text Type (length 11) and unique.
2. Create formula field Billing_Country_Code__c to get country code from Account address.
Billing_Country_Code__C = TEXT(BillingCountryCode)
3. Write Validation rule
Customer_ID_Format
Comments