1

There seems to be an issue with displaying Person Account recordtypes in a VF page (as a field or in a table) - it says the recordtype is invalid for 'Account'.

I'm listing the results of an account list which is a mix of standard Account records and Person Account records. The standard recordtypes display fine, but not the PersonAccount ones.

My controller code that gets the values:

public void displayAccounts(){
    colHeaders = new string[]{'Name','RecordTypeId','PersonEmail'};
    acclist = [select name, recordtypeid, personemail from account] ;
    system.debug('####importTestDataFromCSVController acclist: ' + acclist);        
}

And my VF page display:

    <apex:pageBlock >
        <apex:pageBlockTable id="importvalues" value="{!accList}" var="rec">                
            <apex:repeat value="{!colHeaders}" var="FieldLabel"> 
                <apex:column value="{!rec[FieldLabel]}"/> 
            </apex:repeat> 
        </apex:pageBlockTable>        
    </apex:pageBlock>

This is what displays on the page:

Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Record Type ID: value not valid for the entity: Account".

If I exclude the PersonAccount records, it displays fine showing the name of the standard Account recordtype.

How do I get it to work with Person Accounts?

0

It seems to be related to this known issue and unfortunately there is no fix.

You can try to create a formula field that stores Account RecordType Id or label and reference the formula field in the VF to see if this can workaround the issue.

|improve this answer|||||
  • Thanks Shamina. I've created a case with SF and will see what they come up with, as the Known Issue doesn't give me the option to add myself as also having this issue, and it's from 2017 with no update. – Irene Dec 18 '19 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.