0

I'm trying to write some standard Contact's fields e.g. MobilePhone and Email (I'm new to this object), when I create a new PersonAccount.

For example using an Anonymous window I tried with this code:

Account acc = new Account(FirstName='User', 
                         LastName= 'System',
                         MobilePhone=33900000,
                         Email = '[email protected]'
);
insert acc;

I receive this error: "Field does not exist: MobilePhone on Account".

How is possible to write standard Contacts's field when creating a PersonAccount?

1 Answer 1

0

You use the Person fields:

Account acc = new Account(FirstName='User', 
                         LastName= 'System',
                         PersonMobilePhone='33900000',
                         PersonEmail = '[email protected]'
);
insert acc;
2
  • Thank you! In general, Can I access Contact's standard fields? e.g. Description, Salutation...or any other standard field?
    – sdfcwolf
    Apr 24, 2020 at 12:37
  • @sdfcwolf I believe you can access most, if not all, the standard fields, plus you can access any custom field (use CustomField__pc instead of CustomField__c).
    – sfdcfox
    Apr 24, 2020 at 12:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .