function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
venkata someswara rao vejjuvenkata someswara rao vejju 

how to convert person accounts to business accounts using trigger

Hi All,

I want to convert person account to business account using trigger can any one suggest.
Thank You
SandhyaSandhya (Salesforce Developers) 
Hi,

Please refer below sample code in apex
 
Account a = new Account(Name='Test');
insert a;
Contact c = new Contact(LastName='Test', AccountId=a.Id);
insert c;
RecordType t = [SELECT Id FROM RecordType WHERE IsPersonType = TRUE LIMIT 1];
a.RecordTypeId = t.Id;
update a; // This is now a person account when this call completes.

From below link.

http://salesforce.stackexchange.com/questions/57885/any-way-to-convert-business-account-into-person-account-using-apex
 
https://success.salesforce.com/answers?id=90630000000gth0AAA
 
Hope this helps you!

If this helps you please mark it as solved.

Thanks and Regards
Sandhya