无法在人员帐户SalesForce中插入记录

时间:2015-08-18 14:37:31

标签: salesforce apex

我已激活个人帐户并尝试在APEX的帮助下插入记录。这是我的代码

Account pAccount = new Account();
pAccount.recordTypeId = '012370000009dFh';
pAccount.FirstName = 'SFDC';
pAccount.LastName = 'Axel';
pAccount.personEmail = 'axel@sales.com';
insert pAccount;
return 'Added'; 

但是当我尝试在显示错误后运行此代码时:

Error: call to URL https://XXXX.salesforce.com/services/apexrest/v2/setOrder/ 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

(没有验证问题。) 请帮帮我

1 个答案:

答案 0 :(得分:1)

"标准记录类型设置"必须将Force.com站点上的记录类型更改为Account对象所需的记录类型。它们不需要在insert语句中指定recordTypeID。

同时确保用户具有对所有模块的适当访问权限。