• po3211
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies

I'm following the documentation on updating an object with a relationship field, but I'm getting an error. The documentation says to format the xml as such when referring to a relationship field:

 

<RelationshipName>
  <sObject>
    <IndexedFieldName>rwilliams@salesforcesample.com</IndexedFieldName>
  </sObject>
</RelationshipName>

 

In my case the xml looks something like this:

 

 

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
  <sObject>
    <location_external_id__c>1234</location_external_id__c>
    <Name>My Location</Name>
    <Account__r>
      <sObject>
        <account_external_id__c>7890</account_external_id__c>
      <sObject>
    </Account__r>
  </sObject>
</sObjects>

 

This is an attempt to upsert to a custom object (Location__c) with an external id api name of 'location_external_id__c' that has a text field called 'name' and a Master-Detail(Account) field with relationship name 'Account__r'.  Account has an external id field called account_external_id. As far as I can tell this is all following the documentation for the bulk api. However I get back an error like this:

 

<results xmlns="http://www.force.com/2009/06/asyncapi/dataload">
  <result>
    <errors>
      <fields>Account__r</fields>
      <fields>sObject</fields>
      <fields>account_external_id__c</fields> 
      <message>Location__c: bad field names on insert/update call: Account_r, sObject, account_external_id__c</message>
      <statusCode>INVALID_FIELD_FOR_INSERT_UPDATE</statusCode>
    </errors>
    <success>false</success>
    <created>true</created>
  </result>
</results>

 

This looks to me like the Bulk API doesn't know anything about relationship fields despite what the documentation clearly says. Hopefully I'm just doing something wrong, does anyone have any ideas?

 

 

 

 

We create csv file by reading the data from database into it.

csv format is as below:

 

FirstName,LastName,Description

ABC,XYZ,DEFGH

 

We load the data using SFDC bulk load api.

In response we get the result as below which contains SFDC generated IDs of the records for which upload is successful

 

 "Id","Success","Created","Error"

 "0032000000ZlGn1AAF","true","true",""

 

The result doesn't contain anything from the records in the csv used to upload the data, so we can't map the csv records with the results.

How to update the database records which were uploaded in to salesforce based on the result received?

 

Thanks.

I'm following the documentation on updating an object with a relationship field, but I'm getting an error. The documentation says to format the xml as such when referring to a relationship field:

 

<RelationshipName>
  <sObject>
    <IndexedFieldName>rwilliams@salesforcesample.com</IndexedFieldName>
  </sObject>
</RelationshipName>

 

In my case the xml looks something like this:

 

 

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
  <sObject>
    <location_external_id__c>1234</location_external_id__c>
    <Name>My Location</Name>
    <Account__r>
      <sObject>
        <account_external_id__c>7890</account_external_id__c>
      <sObject>
    </Account__r>
  </sObject>
</sObjects>

 

This is an attempt to upsert to a custom object (Location__c) with an external id api name of 'location_external_id__c' that has a text field called 'name' and a Master-Detail(Account) field with relationship name 'Account__r'.  Account has an external id field called account_external_id. As far as I can tell this is all following the documentation for the bulk api. However I get back an error like this:

 

<results xmlns="http://www.force.com/2009/06/asyncapi/dataload">
  <result>
    <errors>
      <fields>Account__r</fields>
      <fields>sObject</fields>
      <fields>account_external_id__c</fields> 
      <message>Location__c: bad field names on insert/update call: Account_r, sObject, account_external_id__c</message>
      <statusCode>INVALID_FIELD_FOR_INSERT_UPDATE</statusCode>
    </errors>
    <success>false</success>
    <created>true</created>
  </result>
</results>

 

This looks to me like the Bulk API doesn't know anything about relationship fields despite what the documentation clearly says. Hopefully I'm just doing something wrong, does anyone have any ideas?

 

 

 

 

hi All,

I am trying to use Bulk API and I have a scenario while upserting a Contact record I need to add reference to  Account using External ID. I did this using regular WebService API, but unable to do the same using Bulk API

 

as com.sforce.async.SObject does not have a method setField(String fieldName, SObject value). I was able do this with com.sforce.soap.partner.sobject.SObject

 

Any help or suggestions on this is appreciated.

 

Thanks in advance,

Ramana Maddikunta 

 

  • January 12, 2010
  • Like
  • 0