0

Well, I just figured it out, but since I wrote it up already, I figured I'd post it here anyways in case anyone else has the same issue.

I have two custom objects Case__c and CaseActivity__c that are related through a look-up field named Case__c. The Case__c object has an external Id field named CaseId__c. The goal is to be able to get an automated script going where I can insert the cases and then the activities right after with just the cases' external id.

The mapping file (which worked in the gui) includes:

Case__r.CaseId__c=Case__r\:CaseId__c

The csv file (which worked in the gui) includes a field named:

Case__r.CaseId__c,
<CASE_ID>,

The process is defined in the process-conf.xml file as:

<bean id="upsertCaseActivityProcess"
      class="com.salesforce.dataloader.process.ProcessRunner"
      singleton="false">
    <description>Upserts Case Activities</description>
    <property name="name" value="upsertCaseActivityProcess"/>
    <property name="configOverrideMap">
        <map>
            <entry key="sfdc.debugMessages" value="true"/>
            <entry key="sfdc.debugMessagesFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\status\accountMasterSoapTrace.log"/>
            <entry key="sfdc.endpoint" value="https://test.salesforce.com"/>
            <entry key="sfdc.username" value="<USER_NAME>"/>
            <entry key="sfdc.password" value="<ENCRYPTED_PASSWORD>"/>
            <entry key="process.encryptionKeyFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\mi.key"/>
            <entry key="sfdc.timeoutSecs" value="600"/>
            <entry key="sfdc.loadBatchSize" value="200"/>
            <entry key="sfdc.externalIdField" value="" />
            <entry key="sfdc.useBulkApi" value="true" />
            <entry key="sfdc.entity" value="CaseActivity__c"/>
            <entry key="process.operation" value="upsert"/>
            <entry key="process.mappingFile" value="c:\Program Files (x86)\salesforce.com\Data Loader\samples\conf\upsertCaseActivityMap.sdl"/>
            <entry key="dataAccess.name" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\data\caseActivityData.csv"/>
            <entry key="dataAccess.type" value="csvRead"/>
            <entry key="dataAccess.readUTF8" value="true"/>
            <entry key="process.outpuError" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\status\error.csv" />
            <entry key="process.outputSuccess" value="C:\Program Files (x86)\salesforce.com\Data Loader\samples\status\success.csv" />
            <entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800"/>
        </map>
    </property>
</bean>

I have been seeing exceptions like:

[AsyncApiException exceptionCode='InvalidJob' exceptionMessage='Field name provided, does not match an External ID for CaseActivity__c']

1 Answer 1

0

The solution for me was to change the operation from upsert to insert:

<entry key="process.operation" value="insert"/>

It looks like it's not possible for the command line tool to upsert objects based on salesforce ids.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .