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
Devaki Nandan SwamiDevaki Nandan Swami 

Person Account

Hi All,

I am working on person account , and need to extract contact id so i can link that contact with my others object.
 
Best Answer chosen by Devaki Nandan Swami
Amit K AAmit K A
Devaki I want to say one more thing ,that please use this query as dynamic query, so that it will work every where , as if you run the same code in the org which has not person account enable ,then you get error.

so please be carefull. 

All Answers

Amit K AAmit K A
when person account is enable you can find all contact field is on account object.

for contact id we have a field name "PersonContactId"

Select PersonContactId from Account where Id="001..."

this query will give you the contact id ,you can use it and link with any object which has relation with contact.
Devaki Nandan SwamiDevaki Nandan Swami
Thanks Amit,

It works for me , thanks again.
Amit K AAmit K A
Devaki I want to say one more thing ,that please use this query as dynamic query, so that it will work every where , as if you run the same code in the org which has not person account enable ,then you get error.

so please be carefull. 
This was selected as the best answer
Devaki Nandan SwamiDevaki Nandan Swami
good iinformation amit, i make a note of it ,and do it same way
Bruce L StewartBruce L Stewart
@Amit K A - is this true "when person account is enable you can find all contact field is on account object" of custom objects related to the contact object?  Meaning - does the Account Record now contain the RELATION to the custom object?