function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mromanimromani 

Upsert

Does an upsert always need a field that is an externalID?

 

I am trying to upsert a standard object (Account), in which i wanted to do it based on Account Name.

 

This is my code:

 

sforce.UpsertResult[] upResult2 = binding.upsert("Name", objList2);

 

but when i run it, it ends up saying "Field name provided, Name does not match an External ID, Salesforce Id, or indexed field for Account"

 

what can i do to fix this error?

 

Mark SFMark SF

 See the doc at

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_upsert.htm

 

On custom objects, upsert() uses an indexed custom field called an external ID to determine whether to create a new object
or update an existing object. On standard objects, this call can use the name of any field with the idLookup field property
instead of the external ID.

 

The Name field in Account does not have the idLookup field property. You can use the ID field instead or see the link above for a Java sample that uses a custom external ID field on Account. I hope that helps ... 

Message Edited by Mark SF on 12-29-2009 03:23 PM