When using State & Country picklist functionality, is it possible to write a Validation Rule that targets the Billing State or Shipping State fields to make them required but only when the Country has States?
Since some Countries do not have States/Regions and this is a restricted picklist field, Salesforce prevents bad data at the database level as well as in the native UI. A Country with no States will always have a blank value in the State field(s).
So, for a Country which doesn't have any States configured, and therefore will accept no data in the Billing State or Shipping State address fields, what is the appropriate way to write the Validation Rule?
My functional requirement:
- If the Country has States and BillingStateCode is blank, display error.
- If the Country does not have States, BillingStateCode can (and must) be blank.