+ Start a Discussion
dfiredfire 

Record Type ID: value not valid for the entity: PersonAccount

I posted this problem on Sunday but with little response, so I am trying again now that it's the middle of the week.

 

Here is the original post

http://boards.developerforce.com/t5/Visualforce-Development/error-creating-a-Person-Account-in-a-custom-controller/td-p/248719

 

I am trying to create a new Account object which is a person account, however no matter what I try, I keep getting the error

 

Record Type ID: value not valid for the entity: PersonAccount, if I use a default constructor

 

or

 

Record Type ID: value not valid for the entity: Account, if I set the record type id in the constructor.

 

All of my profiles have the person account record type enabled, at least when I click on the record type assignments they are all listed as set to person account and person account is the default record type. I am working in DE as the system admin. I tried adding the Business Account record type to admin, and even tried setting it to default and then ran the code with a default constructor. No change.

 

I am going out of my mind, as I can't seem to locate the problem and can't progress. Not to mention there seems to be relatively little documentation and examples on using person accounts, especially in apex.

Best Answer chosen by Admin (Salesforce Developers) 
dfiredfire

I discovered the issue was having a custom picklist that was using the apex:inputfield tag. I posted a new post asking how to add a custom picklist to a VF page.

All Answers

dfiredfire

I discovered the issue was having a custom picklist that was using the apex:inputfield tag. I posted a new post asking how to add a custom picklist to a VF page.

This was selected as the best answer
sfdeveloper9sfdeveloper9

Hello dfire,

 

I am facing the same issue.

 

we have person accounts enabled and I am overriding Edit button to go to VF page. it works for business account rec types but not for person accounts, and custom picklist is the issue. Is there any work around for this or am I missing something.

I appreciate any help on this.

 

Thanks in advance

PK

dfiredfire

DK,

 

There is a bug (I confirmed this via other posts who have checked with SFDC) using inputfield on a picklist in a person account.

 

So I have seen 2 options.

 

1) Quinton Wall has a blog post using getDescribe() to pull simulate what inputfield should do. I didn't get it to work, but I didn't try hard.

http://blog.sforce.com/sforce/2008/12/using-the-metadata-api-to-retrieve-picklist-values.html

 

2) create a List in apex and load it with the options you want and in VF use <apex:selectlist value="{!yourSFfield}"> and <apex:selectoptions value="{!yourApexList}"> to create a selectlist that works and will connect to your sf field. This is what I did as our values are fairly static.

gliustonecobragliustonecobra

Anybody happen to know of a timeline for a fix?

 

FYI we're actually seeing it happen for any picklist, mulit or single, on any contact or account

gliustonecobragliustonecobra

oof I just noticed the timestamps on the original thread.....did this just get regressed in winter 2012?