Task
Create a Person Account
Considerations
- Enable Person Accounts
- Add person account record type the user's profile.
Solution
Account personAccount = new Account();
personAccount.FirstName = 'John';
personAccount.LastName = 'Smith';
RecordType personAccountRecordType = [SELECT Id
FROM RecordType
WHERE SObjectType = 'Account'
AND IsPersonType = true AND Name = 'Person Account' LIMIT 1];
personAccount.RecordTypeId = personAccountRecordType.Id;
insert personAccount;
Video
Video does not exists.