Skip to main content
I have a few thousand contacts and we're switching to Person Accounts since we're essentially a B2C company.

I'm writing a migration script using the API. I have a particular Contact, and I want to create a new PersonAccount associated with that contact.

I've tried just creating the account with the PersonAccountId value set to the contact's Id, but that gives me an error.

 

conn.sobject("Account").create({

FirstName: contact.FirstName,

LastName: contact.LastName,

PersonAccountId: contact.Id

});

That gets me 

INVALID_FIELD_FOR_INSERT_UPDATE: Unable to create/update fields: PersonContactId

I can see the PersonContactId field in the Account when I query it, but I guess it's read only.

What's the proper way to do this?

Thanks

 -- Steve

 
1 answer
  1. Mar 10, 2020, 8:19 PM

    Sorry, the code block should be:

    conn.sobject("Account").create({

    FirstName: contact.FirstName,

    LastName: contact.LastName,

    PersonContactId: contact.Id

    });

0/9000