I am currently working on a tool that manipulates various custom files, and merges the data into local C#.net lists. Once I have traversed these files I am creating records and uploading to SalesForce. As the title suggests, I am using C#.net and have followed the API reference (created a web reference in Visual Studio) etc.
Everything is working fine based on insert operation - awesome! However, as this tool will be run periodically, and I don't want duplicates in SalesForce I am trying to Upsert records to SalesForce.
I have set CustomerReference__pc as an external ID, and the field is also set to Unique.
If you are upserting a record for an object that has the External ID attribute selected but not the Unique attribute selected, (a non-unique index) your client application must have the permission “View All Data” to execute this call. (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_upsert.htm)
However, I keep getting an error message, saying that I have not set an external ID or the field is not unique.
Is this a problem/limitation because I am using person accounts?
Source Code
foreach (var Xrecord in CustomerCSVRecords)
{
MyList.Add(new Account
{
FirstName = Xrecord.Forename,
LastName = Xrecord.Surname,
PersonBirthdate = Xrecord.DOB,
RecordTypeId = recordTypeIds["B2B Customer"],
CustomerReference__pc = Xrecord.CRC
});
}
var myArray = myList.toArray();
var results = SalesForceBinding.upsert("CustomerReference__pc", myArray);
Error Message
Additional information: INVALID_FIELD: Field name provided, CustomerReference__pc does not match an External ID, Salesforce Id, or indexed field for Account