Print this page

"IsPersonAccount" in formula field on Contact is inconsistent across UI and API with RecordType field

Knowledge Article Number 000220026
Description When you have a formula field on the Contact object that utilizes the "IsPersonAccount" check-box, it may not return the results you are expecting through the API unlike the result in the UI. 

This inconsistency is due to the context from which the field originates. The IsPersonAccount in this instance is from the Contact Object, so through the API is it taking the Person Contact record into consideration while in the UI it is treating the context as a Person Account. In the UI when accessing a Person Account from either the Account or Contact list views it will always load the Person Account page in the Account tab style. 

For most of the fields on the Person Account and Person Contact tables, the related standard fields are mapped and synchronized across. It has been identified that this is not occurring for RecordType/RecordTypeId.  This is working as designed given that Person Accounts can behave like Contacts but are actually Account records.

You can reproduce this as follows:

1) On the Contact object create the following formula field with API name Contact_AccountRecordType__c: 
Account.RecordType.Name

2) Create a second formula field on the Contact object as follows: 
IF(IsPersonAccount, 
RecordType.Name, 
Contact_AccountRecordType__c)

3) Now open a Person Account record and you will see this field is populated with the Person Account record type name. 

4) Perform a SOQL query on the Person Account above and retrieve the formula field above. 
Result: The value returned will be null (blank) 



To better see this in action, the best way is to see it is by record Id. 

1) Create the following formula on the Contact object, API name Contact_AccountId__c: 
Account.Id

2) Create another formula on the Contact object like previously except for Id: 
IF(IsPersonAccount, 
Id, 
Contact_AccountId__c)

3) Opening the Person Account record in the UI and you will see: 001############ 

4) Query the above formula and Id for the given Person Account 
Result: The Id will be of the Account where the formula will be of Contact: 003############
Resolution As a workaround, instead of using "IsPersonAccount" on the Contact object, you should check if the Id is of an Account considering the only time it will be on that object is if it is a Person Account. 

So change: 
IF( IsPersonAccount, ..., ...)
to: 
IF( CONTAINS(LEFT(Id, 3), '001'), ..., ...)




promote demote