function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rakesh ERakesh E 

how to differentiate between Person Account specific fields and actual account fields using Apex.

Hi 

 

we have a client org where Person Account is enabled. we want to know what are the fileds specific to "Person Account" record types and "Business Account" recordtypes using Apex.

 

please let me know if anyone has idea about this.

 

Thanks in advance

 

Regards

Rakesh

Rahul_sgRahul_sg

see this query :

Select a.Phone, a.PersonMailingStreet, a.PersonBirthdate, a.BillingCity From Account a

 

here fields/colums starting with Person are related to person account rest of the fields are related to Account.

JFraileJFraile

Hi.

 

Each 'person account' has a 'shadow' contact object, witch Id can be retrieve using the PersonContactID from the account object. Thus, you can access contact fields for person accounts two ways:

1.- Querying the underlaying contact and accessing the field as you would a normal contact field

2.- Accessing the field on the account using the special prefix 'Person', ex:PersonEmail. Valid just for standard fields. FirstName, LastName and Salutation do not have this prefix.

 

3.- Accessing the field on the account using the special suffix __pc instead of __c. Valid just for custom fields.

 

Take a look to this link for more detail http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_objects_account.htm|StartTopic=Content%2Fsforce_api_objects_account.htm|SkinName=webhelp