Skip to content

Flow Name: On Person Account Create: Create a Buyer user

Last Updated: 2024-09-17 Source Code: On_Person_Account_Create_Create_a_Buyer_user.flow-meta.xml

API Name: On_Person_Account_Create_Create_a_Buyer_user Status: Active Type: Custom Trigger: After Save on Account record creation when IsPersonAccount = true

Business Purpose

Automates external user creation for new Person Accounts by creating community users with AANP External Identity profile and assigning Commerce Shopper permissions. Enables person accounts to become buyers in the commerce platform.

Process Flow

  1. User Type Check: Validates running user type is not Standard and record wasn't created from wizard
  2. Profile Lookup: Gets AANP External Identity User Profile for community user creation
  3. Profile Validation: Confirms profile exists before proceeding
  4. User Creation: Creates new User record with:
  5. Contact linked to Person Account
  6. Username = PersonEmail + Today's Date
  7. Alias = First 5 characters of LastName
  8. Community Nickname = Last 40 characters of PersonEmail + Today's Date
  9. Profile = AANP External Identity User
  10. Standard locale/timezone settings (en_US, America/Chicago)
  11. Permission Set Group Lookup: Finds AANP_Commerce_Shopper permission set group
  12. Platform Event: Creates User_Creation__e platform event to assign permission set group asynchronously
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: After Save on Account record creation when IsPersonAccount = true]) --> Check{Entry Criteria<br/>Met?}

    Check -->|No| End([End])
    Check -->|Yes| Process[Execute Business Logic]

    Process --> Update[Update Records]
    Update --> End

    style Start fill:#e1f5ff
    style Check fill:#fff4e1
    style Process fill:#e1ffe1
    style Update fill:#ffe1e1
    style End fill:#e1f5ff

Key Business Rules

  • Only processes Person Account records on creation
  • Requires running user to not be Standard type and record not from wizard
  • User creation fails if AANP External Identity profile doesn't exist
  • Username formula ensures uniqueness by appending current date
  • All users created as active community users with USD currency
  • Permission set assignment handled via platform event for async processing

Dependencies

  • Account object (IsPersonAccount, PersonEmail, LastName, PersonContact, Created_from_Wizard__c)
  • Profile named containing "AANP External Identity"
  • PermissionSetGroup with DeveloperName containing "AANP_Commerce_Shopper"
  • User_Creation__e platform event object
  • Contact object linked to Person Account

Changes

PR-27923: Automate external user creation for Person Account and enabling it as a Community user and a Buyer

⚠️ Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • Profile Dependency: Flow fails if AANP External Identity profile is missing or renamed
  • Username Conflicts: Username formula could create duplicates if same email creates accounts on same day

HIGH - Address Soon After Go-Live

  • Permission Set Group Dependency: Silent failure if AANP_Commerce_Shopper group doesn't exist
  • Platform Event Processing: No error handling if platform event fails to assign permissions
  • User Activation: No validation that created user can actually access community

MEDIUM - Future Enhancement

  • Add error handling and retry logic for user creation failures
  • Implement username uniqueness validation
  • Add audit logging for successful/failed user creations
  • Consider email verification before user activation

LOW - Monitor

  • Performance impact of synchronous user creation on account creation
  • Community nickname uniqueness with current formula approach
  • Timezone assumption (America/Chicago) for all users

Maintenance Notes

Complex flow with multiple dependency lookups. Monitor for failures due to missing profiles or permission set groups. Consider moving user creation to async process for better performance. Trigger order 200 may cause conflicts with other account flows.