Unable to insert record in Person Account SalesForce
Matthew Martinez
I have activated Person Account and try to insert record with the help of APEX. Here is my code
Account pAccount = new Account();
pAccount.recordTypeId = '012370000009dFh';
pAccount.FirstName = 'SFDC';
pAccount.LastName = 'Axel';
pAccount.personEmail = '[email protected]';
insert pAccount;
return 'Added'; But when I try to run this code following error displayed:
Error: call to URL failed with status 500, response [{"errorCode":"APEX_ERROR","message":"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, entity type cannot be inserted: Person Account: []\n\nClass.RESTCaseController.createNewCase: line 22, column 1"}], curl_error , curl_errno 0(There is no validation issue.) Please help me
1 Answer
The "Standard Record Type Settings" on the Force.com Site have to be changed to the recordtype you require for the Account object. There is no need to them specify the recordTypeID in the insert statement.
Also Ensure that the user has the appropriate access to all modules.
Ash
2