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
dlampdlamp 

Accessing PersonContactId

We use PersonAccounts.

On the standard Opportunity object, I have created a Lookup field on Contact, and this field is also added to a Opportunity Page Layout. In edit mode on this page, I can select a PersonAccount as the Contact. Dataloader shows that the value placed in the Lookup field is the PersonContactId of the Account associated with the Opportunity.

All is good--this is just what I want.

Extending the above, I want in Apex to set the Opportunity Lookup field to the same value as I did via the Page layout--which means when I'm done, I want that to be the PersonContactId of the Account associated with the Opportunity. Is this possible? If so, how?