You need to sign in to do that
Don't have an account?

HOW TO: Convert existing contact to person account???
we just enabled person account on the contact object, but there are lots of existing contacts do not have any 1 to 1 person account on account object,
Is there any way to create person accounts for these existing contact without deleting these contacts, as these contacts were referenced by different objects;
here is my code trying to do: the record type in account is updated successful, but is IsPersonAccount is field in Account is still set to false
Code:
//get the business account record type RecordType NotPersonAccountRecordType = [select Id, Name, SobjectType, IsPersonType from RecordType where SobjectType='Account' and IsPersonType=False]; // get 1 existing account Contact c = [select id, AccountId, FirstName, LastName, Cris_Id__c from Contact where IsPersonAccount = false Limit 1]; // create a new account and set the record type to business account Account newAccount = new Account(); newAccount.Name='' + c.LastName; newAccount.RecordTypeId = NotPersonAccountRecordType.Id; insert newAccount; //get the person account record type recordType personaccountrecordtype = [select Id, Name, SobjectType, IsPersonType from RecordType where SobjectType='Account' and IsPersonType=True]; // update the existing contact's account to new account c.AccountId = newAccount.Id; update c; // now get it again and update the firstname and lastname, change the record type to person account newAccount = [select id,lastName, Firstname, RecordTypeId from Account where Id =: newAccount.Id]; newAccount.RecordTypeId = personaccountrecordtype.Id; newAccount.LastName=c.LastName; newAccount.FirstName=c.FirstName; update newAccount;
These code runs successfully, but the IsPersonAccount in Account object is false for some reason
Any one have idea how to get around the problem or other direction to do these?
thanks in advance
Message Edited by Feng on 12-10-2008 05:57 PM
Message Edited by Feng on 12-10-2008 05:59 PM
Hi, Ron, i had to change my name login to get my password :(
we work around this problem by creating a CSharp application to convert them into personal account
"The record type can only be changed via the API, using a tool like Data Loader or the Excel Connector"
please go these website for more details
http://www.x2od.com/2008/08/19/convert-between-business-and-person-accounts-b2b-b2c.html
Hope that helps
Feng
All Answers
Feng, did you ever figure this one out? I'm running into the same problem:
Have created one account and one related contact.
Tried to change the record type to a person account record type.
The operation succeeds (record type id is changed) but the contact and account are still separate entities (also, trying to view the account produces an error)
Here is the code I ran from the Execute Anonymous window in Eclipse (sandbox account) to test the conversion:
Contact newContact = new Contact( firstname= 'Bob', lastname='Test', email = 'bob@test.com'); insert newContact; Account newAccount = new Account (name = 'Bob Test'); insert newAccount; newContact.accountId = newAccount.Id; update newContact; //get the person account record type RecordType personaccountrecordtype = [select Id, Name, SobjectType, IsPersonType from RecordType where SobjectType='Account' and IsPersonType=True]; Account[] convertAccounts = [Select id, RecordtypeId from Account where Id = :newAccount.Id ]; convertAccounts[0].RecordTypeId = personaccountrecordtype.Id; convertAccounts[0].LastName = newContact.lastname; System.debug(Database.update(convertAccounts));
... and the error Salesforce shows when trying to view the account created above:
An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@salesforce.com. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. Thank you again for your patience and assistance. And thanks for using Salesforce! Error ID: 2092721332-769 (-328500233)
Hi, Ron, i had to change my name login to get my password :(
we work around this problem by creating a CSharp application to convert them into personal account
"The record type can only be changed via the API, using a tool like Data Loader or the Excel Connector"
please go these website for more details
http://www.x2od.com/2008/08/19/convert-between-business-and-person-accounts-b2b-b2c.html
Hope that helps
Feng
Just an update for anyone following this thread .... we've implemented both a batch Apex convert to person account solutioni as well as on-click javascript buttons that users can click to convert individual account/contact pairs to person accounts. (note: the account/contact pairs meet SF's requirements for conversion (identical values in fields shared between accounts and person_contacts):
Here's the javascript code:
Just replace the "012xxxxxxxxxxxx" with the record type id for a person account in your SF org.
Can you help me with the code for a button on a Contact detail page to convert a contact without an acccount to a person account?
And will it work if there is no account yet, only a contact?