Search code examples
javasalesforcebulkinsertbulkloaderbulk-load

Bulk API errors: Upsert on Standard Salesforce Object


We're using Bulk Api to upsert records for both Custom and Standard Salesforce Objects. Its working fine for custom objects but when We're trying to perform Upsert operation on a Standard Salesforce Object say: Account, the error of specifies Invalid External ID specified as:

[AsyncApiException exceptionCode='InvalidJob' exceptionMessage='Field name provided, Name does not match an External ID, Salesforce Id, or indexed field for Account' ]

We're providing Name as an external ID through java code.


Solution

  • Account.Name is not an external Id field! And neither is AccountNumber for that matter. I guess you're confused because it can be used as match field for de-duplication in "import my accounts & contacts" etc?

    Here are my results, I don't think you'll get different ones:

    Schema.DescribeFieldResult f = Account.Name.getDescribe();
    System.debug(f.isExternalID());  // false
    System.debug(f.isUnique());      // false
    System.debug(f.isIdLookup());    // false
    

    You'll need to create your own Ext. Id. field if you want to use it in upserts (and fill it with data). In my org we have custom Account_Number__c...