Salesforce Decode
Salesforcedecode
Back to questions
ApexAdvancedperson-accountsb2c

Handle Person Accounts in Apex trigger logic

Real World Scenario

Account trigger assuming Business Account fields breaks on Person Account records in unified B2B/B2C org.

Expected Answer

• Schema.SObjectType.Account.isPersonType or RecordType check • Separate logic paths or dedicated PersonAccount trigger handler • PersonContactId relationship for contact-field access • Test with Person Account record type in @TestSetup • Document which automation applies to which account type • Avoid assuming Account.Name is company name • Integration maps person vs business explicitly

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Direct answer: Schema.SObjectType.Account.isPersonType or RecordType check Also consider: Separate logic paths or dedicated PersonAccount trigger handler In practice: PersonContactId relationship for contact-field access Optimize for scale and operational observability.

Architect Perspective

Person Accounts bifurcate data model—architect explicit branching early in program.