I've got a page that inserts/updates a custom setting record. I'm using upsert for this purpose but I've run into an error:
There is already an item in this list with the name 005700000037xJaAAI System.DmlException: Upsert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, There is already an item in this list with the name 005700000037xJaAAI: [Name]
Obviously this is happening because my upsert statement is attempting to insert the record when it really should be trying to update it.
Since there is no external Id field, what is the criteria Salesforce is using to determine if this should be an update or an insert?
UPDATE
I was under the assumption that it would default to the "Name" field. It looks like I can explicitly specify the name field by doing something like this:
upsert myCustomSetting Name;