Skip to content

Flow Name: On Person Account: Country Groups Assignment

Last Updated: 2025-08-03 Source Code: On_Person_Account_Country_Groups_Assignment.flow-meta.xml

API Name: On_Person_Account_Country_Groups_Assignment Status: Obsolete Type: Custom Trigger: After Account create/update when mailing country changes (Person Accounts only)

Business Purpose

Assigns Person Accounts to international pricing tier buyer groups (Tier 1, 2, 3) based on billing country codes and manages ContactPointAddress records for shipping. Countries in each tier are defined in Custom Metadata Types. PR-31175 added ContactPointAddress synchronization logic.

Process Flow

  1. Triggers on Person Account create/update when:
  2. PersonMailingCountryCode changes OR
  3. IsBuyer flag changes
  4. Account must be IsBuyer = true

  5. Retrieve Buyer Groups:

  6. Gets "International Tier 1", "Tier 2", and "Tier 3" buyer groups
  7. Stores IDs in collection for later comparison

  8. ContactPointAddress Management:

  9. Looks up existing default Shipping ContactPointAddress
  10. If exists: Updates with current PersonMailingAddress fields
  11. If not exists: Creates new ContactPointAddress with PersonMailingAddress data
  12. Populates name using FirstName + LastName for Person Accounts

  13. Remove Old Country Assignments:

  14. Finds existing BuyerGroupMember records for any international tier groups
  15. Deletes them to prevent multiple tier assignments

  16. Assign New Country Group:

  17. Looks up country in Countries_Group_1__mdt (Tier 1)
  18. If found: Assigns to International Tier 1 buyer group
  19. Else checks Countries_Group_2__mdt (Tier 2)
  20. If found: Assigns to International Tier 2
  21. Else checks Countries_Group_3__mdt (Tier 3)
  22. If found: Assigns to International Tier 3
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: Country/IsBuyer Change]) --> GetGroups[Get International Tier Groups]
    GetGroups --> UpdateAddress[Update/Create ContactPointAddress]
    UpdateAddress --> RemoveOld[Remove Old Tier Assignments]
    RemoveOld --> CheckTier1{In Tier 1<br/>Metadata?}
    CheckTier1 -->|Yes| AssignT1[Assign Tier 1]
    CheckTier1 -->|No| CheckTier2{In Tier 2<br/>Metadata?}
    CheckTier2 -->|Yes| AssignT2[Assign Tier 2]
    CheckTier2 -->|No| CheckTier3{In Tier 3<br/>Metadata?}
    CheckTier3 -->|Yes| AssignT3[Assign Tier 3]
    CheckTier3 -->|No| End([End])
    AssignT1 --> End
    AssignT2 --> End
    AssignT3 --> End

    style Start fill:#e1f5ff
    style GetGroups fill:#e1ffe1
    style UpdateAddress fill:#ffe1e1
    style RemoveOld fill:#ffe1e1
    style CheckTier1 fill:#fff4e1
    style CheckTier2 fill:#fff4e1
    style CheckTier3 fill:#fff4e1
    style AssignT1 fill:#e1ffe1
    style AssignT2 fill:#e1ffe1
    style AssignT3 fill:#e1ffe1
    style End fill:#e1f5ff

Key Business Rules

  • Only processes Person Accounts (IsPersonAccount = true)
  • Requires IsBuyer = true and PersonMailingCountryCode not null
  • Account can only be in ONE international tier at a time
  • ContactPointAddress type must be "Shipping" with IsDefault = true
  • Country tier assignments driven by Custom Metadata Types
  • Trigger order: 600 (runs after other account flows)

Dependencies

  • Objects: Account (Person), BuyerGroup, BuyerGroupMember, ContactPointAddress
  • Custom Metadata: Countries_Group_1__mdt, Countries_Group_2__mdt, Countries_Group_3__mdt
  • Fields: ISOCode__c (on metadata), PersonMailingCountryCode, IsBuyer
  • Buyer Groups: "International Tier 1", "International Tier 2", "International Tier 3"

Changes

PR-31175: Added logic to update existing ContactPointAddress record or create new one based on PersonMailingAddress change.

⚠️ Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • FLOW IS OBSOLETE: This flow is marked as Obsolete - should NOT be activated
  • Missing Error Handling: No fault paths for buyer group or ContactPointAddress failures
  • Hardcoded Group Names: "International Tier 1/2/3" buyer group names are hardcoded

HIGH - Address Soon After Go-Live

  • Not Applicable: Flow is Obsolete and should not be used

MEDIUM - Future Enhancement

  • Not Applicable: Flow is Obsolete

LOW - Monitor

  • Not Applicable: Flow is Obsolete

Maintenance Notes

Complexity: High - Multiple lookups, complex decision tree, ContactPointAddress management Status: OBSOLETE - Do not activate this flow Replacement: Likely replaced by Country_Buyer_Group_Assignment subflow called from other buyer group flows Archive Recommendation: Consider deleting if replacement is confirmed active and tested Trigger Order: Set to 600 to run after other flows - indicates this was part of complex orchestration