Flow Name: On External User PSG Assignment Enable User as Buyer¶
Last Updated: 2025-10-22 Source Code: On_External_user_PSG_assignment_enable_user_as_Buyer.flow-meta.xml
API Name: On_External_user_PSG_assignment_enable_user_as_Buyer Status: Active Type: Custom Trigger: Platform Event (User_Update__e)
Business Purpose¶
This flow automatically enables external users as buyers in the commerce system by creating necessary buyer account records and default shipping addresses, ensuring seamless e-commerce functionality for new community members.
Process Flow¶
- Platform Event Received: User_Update__e event triggers with AccountID
- Account Validation: Checks if AccountID exists in the event
- Account Retrieval: Gets full Account details including Person Account mailing address
- Buyer Account Creation: Creates BuyerAccount record with "Pending" status
- Buyer Account Verification: Confirms BuyerAccount was created successfully
- Contact Point Address Creation: Creates default shipping address using Account mailing address
📊 Click to view Process Flow Diagram
flowchart TD
Start([Start: User Update Event]) --> CheckID{Account ID Exists?}
CheckID -->|No| End([End])
CheckID -->|Yes| GetAccount[Get Account Data]
GetAccount --> AccountFound{Account Found?}
AccountFound -->|No| End
AccountFound -->|Yes| CreateBuyer[Create BuyerAccount]
CreateBuyer --> GetBuyer[Verify BuyerAccount Created]
GetBuyer --> BuyerFound{BuyerAccount Found?}
BuyerFound -->|No| End
BuyerFound -->|Yes| CreateAddress[Create ContactPointAddress]
CreateAddress --> End
style Start fill:#e1f5ff
style CheckID fill:#fff4e1
style AccountFound fill:#fff4e1
style BuyerFound fill:#fff4e1
style CreateBuyer fill:#ffe1e1
style CreateAddress fill:#ffe1e1
style End fill:#e1f5ff
Key Business Rules¶
- BuyerAccount Settings:
- BuyerStatus: "Pending"
- CommerceType: "Buyer"
- IsActive: true
- BuyerId: Account.Id
- Name: Account.Name
- ContactPointAddress Settings:
- AddressType: "Shipping"
- IsDefault: true
- IsPrimary: false
- IsThirdPartyAddress: false
- ParentId: Account.Id
- Name Handling:
- Person Accounts: Uses FirstName and LastName separately
- Business Accounts: Uses Account.Name as full name
- Address Mapping: Uses Person Account mailing address fields (PersonMailingStreet, PersonMailingCity, etc.)
Dependencies¶
- Platform Event: User_Update__e
- Standard Objects: Account (Person Account), BuyerAccount, ContactPointAddress
- Upstream Process: User creation flow that publishes User_Update__e events
- Related Flows: May be triggered by permission set group assignment flows
Changes¶
- PR-27923: External user permission set group assignment and buyer enablement
- PR-29601: Buyer group assignment after Person Account created as Never member
- PR-31175: Fixed ContactPointAddress FirstName+LastName assignment defect
Pre-Go-Live Concerns¶
CRITICAL - Fix Before Go-Live¶
- None identified
HIGH - Address Soon After Go-Live¶
- No Error Handling: Flow silently exits if Account not found or BuyerAccount creation fails
- Missing Validation: No check if BuyerAccount already exists before creation (could create duplicates)
MEDIUM - Future Enhancement¶
- Address Validation: No validation that mailing address is complete before creating ContactPointAddress
- Async Issues: Platform event timing may cause race conditions if published before Account is ready
- Logging: No audit trail or error logging for troubleshooting failed buyer enablement
LOW - Monitor¶
- Formula Complexity: Multiple formulas for address parsing; could be consolidated
- Person vs Business: Logic handles both but may have edge cases with business accounts lacking proper address data
Maintenance Notes¶
Complexity: Low to Medium - Straightforward record creation with formula-based address mapping
Review Schedule: Annual review sufficient unless buyer enablement process changes
Testing Requirements: - Test with Person Accounts - Test with Business Accounts - Test with complete mailing address - Test with incomplete or missing address data - Test duplicate buyer enablement scenarios - Verify BuyerAccount status and settings - Verify ContactPointAddress defaults correctly - Test with various name formats (single name, multiple middle names, etc.)