Friday, April 20, 2012

Salesforce INVALID_FIELD_FOR_INSERT_UPDATE when updating Accounts and the __pc field suffix

I recently encountered the following error when updating a Salesforce Account with S4S.

Error INVALID_FIELD_FOR_INSERT_UPDATE - Account: bad field names on insert/update call: Field1__pc, Field2__pc, Field3__pc

Oddly, the fields referenced in the error were actually custom Contact fields. My first thought was an Account trigger the resulted in an update to a related Contact record.

That didn't lead anywhere, but I did notice the custom field suffix was "__pc" rather than the typical "__c".

Turns out the "__pc" suffix is used when the org is configured to use Person Accounts.

Some custom fields have __pc suffix instead of __c. Those are custom fields that have been merged from the Contacts object into the Accounts object. For example, if your Contacts object has a custom field height__c, it becomes height__pc in the Account object. All standard Contact fields are [pre]ppended with "person".
[1]

See also: