I'm facing an issue with one of my batch process when trying to relate records through an external Id.
I have a csv file with info about the record to upsert, and a external id of the account that i want it to be related.
This was working in the previous release, i was even logging the records that couldn't be inserted because the account didn't existed. Since Winter 18, the test cases and the batch process are failing, unable to upsert the records, and throws a "Internal Salesforce.com Error" with no more info.
I can reproduce the error 100% of the times, and once of those i received a mail with the following error message:
Sandbox: Developer script exception from ***** : 'BatchImportarMonitor' :
java.math.BigDecimal cannot be cast to java.lang.String
I raised a case to Salesforce and they told me that my type of license didn't have that service, and that i needed a developer to help my with the problem.
If you could please give me a hand a try to run an anonymous apex trying to insert a SObject with a related record through an external id (being that id not existent) i would be very grateful.
My external id in the account object looks like this:
EDIT: Step by step guide to reproduce the error:
1 Create a new custom field in the Account object, with this info:
Name: Test
Type: Number
Length: 18 (0 decimals)
External Id: Checked
Unique: Checked
2 Go to Developer console an execute the code pasted above. The value of the External id doesn't matter, as long as there isn't any account with that value.
Opportunity opp = new Opportunity();
opp.Account = new Account(Test__c = 929292.0);
insert opp;
3 If you get a DMLException saying that the account doesn't exist, then it's working OK, else, if you get stuck in "Unpackaging result" and you have a log with "Internal Salesforce.com Error" then you were successful in reproducing the issue.
I've follow this steps in a new sandbox (CS14) and got the "Internal Salesforce.com Error".