+ Start a Discussion
jasonzjasonz 

Cannot access PersonContactId from Person Account

I have this problem with salesforce API access from java based on partner WSDL, salesforce support guys cannot resolve this :-(
Really appreciated if anyone can help.

Person Account is a quite new feature from salesforce, and we want to be able to get PersonContactId value from a Person Account based on account ID.  Here is the query which is executed from Java:

QueryResult qr = binding.query("select Id,Name,PersonContactId from Account where id='xxxxxxxxxxxxxxxx'");

And it returned error:

INVALID_FIELD:
select Id,Name,PersonContactId from Account where
^
ERROR at Row:1:Column:16
No such column 'PersonContactId' on entity 'Account'. If you are attempting to
use a custom field, be sure to append the '__c' after the custom field name.
Please reference your WSDL or the describe call for the appropriate names.

But the funny thing is it works if the query is executed from Apex Exlorer 8, i.e., it returned correct PersonContactId value based on account ID.

I also ran describeSObjects() on Account object with java code, and it returns the following fields (Note: it doesn't have any fields when IsPersonAccount = true, including PersonContactId).

############ Account #################
Field name=Id
Field name=Name
Field name=Type
Picklist values =
Item: Prospect
Item: Customer - Direct
Item: Customer - Channel
Item: Channel Partner / Reseller
Item: Installation Partner
Item: Technology Partner
Item: Other
Field name=RecordTypeId
Field references the following objects:
RecordType
Field name=ParentId
Field references the following objects:
Account
Field name=BillingStreet
Field name=BillingCity
Field name=BillingState
Field name=BillingPostalCode
Field name=BillingCountry
Field name=ShippingStreet
Field name=ShippingCity
Field name=ShippingState
Field name=ShippingPostalCode
Field name=ShippingCountry
Field name=Phone
Field name=Fax
Field name=AccountNumber
Field name=Website
Field name=Sic
Field name=Industry
Picklist values =
Item: Agriculture
Item: Apparel
Item: Banking
Item: Biotechnology
Item: Chemicals
Item: Communications
Item: Construction
Item: Consulting
Item: Education
Item: Electronics
Item: Energy
Item: Engineering
Item: Entertainment
Item: Environmental
Item: Finance
Item: Food & Beverage
Item: Government
Item: Healthcare
Item: Hospitality
Item: Insurance
Item: Machinery
Item: Manufacturing
Item: Media
Item: Not For Profit
Item: Recreation
Item: Retail
Item: Shipping
Item: Technology
Item: Telecommunications
Item: Transportation
Item: Utilities
Item: Other
Field name=AnnualRevenue
Field name=NumberOfEmployees
Field name=Ownership
Picklist values =
Item: Public
Item: Private
Item: Subsidiary
Item: Other
Field name=TickerSymbol
Field name=Description
Field name=Rating
Picklist values =
Item: Hot
Item: Warm
Item: Cold
Field name=Site
Field name=OwnerId
Field references the following objects:
User
Field name=CreatedDate
Field name=CreatedById
Field references the following objects:
User
Field name=LastModifiedDate
Field name=LastModifiedById
Field references the following objects:
User
Field name=SystemModstamp
Field name=LastActivityDate
Field name=NumberofLocations__c
Field name=SLAExpirationDate__c
Field name=UpsellOpportunity__c
Picklist values =
Item: Maybe
Item: No
Item: Yes
Field name=SLASerialNumber__c
Field name=SLA__c
Picklist values =
Item: Gold
Item: Silver
Item: Bronze
Item: Platinum
Field name=CustomerPriority__c
Picklist values =
Item: High
Item: Low
Field name=Active__c
Picklist values =
Item: No
Item: Yes
############ Account #################
pfarrellpfarrell
Can we get a comment from someone from Salesforce or if jasonz found an answer? 

I am encountering the same problem.
SuperfellSuperfell
Sounds like you're using an API version that was pre personaccounts. For compatibility reasons, personAccount related fields etc won't appear in the older api versions. You should move up to a current API version.
pfarrellpfarrell
Thanks for the quick reply.  As I'm looking at it, I'm having a slightly different error.  I can start a new thread, but maybe it fits where as well.

I'm creating a custom link to be displayed on Person Account pages.  I want to access the Contact Id for the person account to insert it into my query string...

this is what I'd do if I was trying to send Account id for an Account:

http://mydomain.com/test.cgi?id=${!Account.Id}&...

How can I access the contact id for a Person object?
Ron WildRon Wild
The contact ID in a person account is Account.Id
Ron WildRon Wild
Sorry, after a quick check I see PersonContactId is definitely a valid field - it works in the force.com explorer .... but apparently not as an s-control merge field.   I think I saw this posted as a bug on another thread, so hopefully SF is working on it.
jasonzjasonz
Hi, my partner wsdl version was v11, and after I moved to v12, my issue is resolved.