QUESTION:
We are seeing unit test failures for DupeBlocker which seem to be related to having State and Country picklists enabled:
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, There's a problem with this country, even though it may appear correct. Please select a country from the list of valid countries.: [BillingCountry]
This is preventing us from deploying new code. Is there a way to get around this?
ANSWER:
The problem is that DupeBlocker unit tests are inserting the 2 digit state and country abbreviations and Salesforce requires the LONG form when inserting directly into any state or country fields (except the new "code" fields, but we do not populate those directly).
There are 2 options to workaround this issue and deploy your code:
1. Ignore unit test failures in order to deploy your code. The article, Ignoring DupeBlocker Unit Test Failures, explains how to do this
2. DupeBlocker 3 has the ability for you to provide your own custom test data generator for use in situations like this where our tests fail due to the default test data we use in our unit tests. It's fairly easy to implement and documentation with sample code can be found here under the Custom Unit Test Data section.
Since the "sample" code is the actual data we currently use, you can see that the data that needs to be updated is all the fields on Leads, Contacts and Accounts that populate the various country or state fields. We are populating with "US" for countries and "CA" for states. You will need to change these to "United States" and "California" as when the state/country picklists are enabled you need to supply the full names not the abbreviations. Alternately you could populate the new StateCode and CountryCode fields (with the 2 digit abbreviation) instead of the standard state and country fields.
NOTE: We do plan on fixing this in a future release, but there is no ETA currently.