2

We have a strange issue arising in the context of the Salesforce Standard Deduplication functionality. It happens only, when Country-State-Picklist are enabled and a record (Account) is set to a country, where States are defined.

When we invoke

Datacloud.FindDuplicates.findDuplicates( new SObject[]{ item } );

we get this exception

"TypeName" : "System.HandledException"
"Message" : "Invalid State Code"
"Cause" : "null"
"LineNumber" : -1
"StackTrace" : "External entry point
Class.elfDQPage_Deduplication.itemFindDuplicates: line 87, column 1
Class.elfDQPage_Deduplication.refresh: line 76, column 1"

Line 87 is exactly the line you see above.

It happens on Account. We have deleted ALL Accounts in the org but one single record. We've cleared the recycle bin.

This error disappears under the following circumstances:

  • Disabling the Country-State-Picklists in the setup
  • Selecting a Country, which has no States

But having that single Account set to a country, where States are defined, we get the error back.

Further investigations revealed, that the deletion of records in Salesforce isn't so easy as DELETE ==> EMPTY RECYCLE BIN ==> DEAD but that there is 3 third stage, in which the already emptied bin-data is still existent like a zombie: How can I permanently delete a record whose isdeleted="true"

So the process seems to be DELETE ==> EMPTY BIN ==> PURGE ==> DEAD and the time of PURGE is out of our hands. We have tried to use workbench to execute the PURGE, but unfortunately without success.

The situation is like this:

  • Org-Bin is empty
  • [select Id from Account].size() ==> 1
  • [select Id from Account ALL ROWS].size() ==> 7436
  • Workbench lists the deleted record
  • using the purge button results into an "Invalid Id" error message in Workbench

enter image description here

So we would like to try the PURGE-way, if we only could. Any ideas why Workbench isn't able to execute the PURGE?

We are not 100% sure, that the PURGE would help though.

When we disable an re-enable the Country-State-Picklists, we are getting in the Mapping-Wizzard a list of values, which we can't find in the deleted data. It seems to be, that at least one record would have a CountryCode=ES and a StateCode=CA which does not match. In the wizzard we get

enter image description here

and then

enter image description here

But we can't see that with ALL ROWS:

  • [select Id from Account ALL ROWS].size() ==> 7436
  • [select Id from Account where BillingState = 'CA' ALL ROWS].size() ==> 0
  • [select Id from Account where BillingCountry = 'ES' ALL ROWS].size() ==> 0
  • [select Id from Account where ShippingState = 'CA' ALL ROWS].size() ==> 0
  • [select Id from Account where ShippingState = 'CA' ALL ROWS].size() ==> 0

Now it comes:

We select to change the data to something valid. The wizzard proceeds without error, the Country-State-Picklists get activated. But using Datacloud.FindDuplicates.findDuplicates() the above error is back again.

Any ideas or similar experiences are welcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.