{
  "apiVersion": 56,
  "label": "Account — Default PingCAP Contracting Entity from Region",
  "description": "Before-save default for Account.PingCAP_Contracting_Entity__c derived from Account.Region__c, ported from the retired Salesforce Process Builder 'Account_PingCAP_Contracting_Entity' with one intentional change (LATAM, see below). Region -> entity precedence: Japan -> PingCAP Kabushiki-Kaisha; NA and LATAM -> PingCAP (US), Inc.; APAC / EMEA / (blank) -> PingCAP Pte. Ltd. (the Singapore entity is the catch-all default connector). The retired 'China Outbound' Region was dropped from the Account.Region__c picklist to match Salesforce, and its explicit rule removed with it; that rule targeted Stamp_Singapore, which is the default connector, so removing it is behaviour-neutral - any Region without a rule, including legacy 'China Outbound' data, still resolves to Pte. Ltd. INTENTIONAL CHANGE FROM SOURCE: LATAM -> PingCAP (US), Inc.; in the Salesforce source LATAM had no rule and fell through to PingCAP Pte. Ltd. All other mappings match the source. The fourth contracting-entity picklist option (the Beijing entity) has no Region mapping and is never auto-assigned - finance/ops set it manually, matching the source process. Only fills blanks: the start filter runs the flow solely when PingCAP_Contracting_Entity__c IsNull, so a value that is already set (including a deliberate cross-entity choice) is never overwritten. Runs on CreateAndUpdate so a blank account self-heals on its next edit; note this also means clearing the field on an account whose Region has a default re-derives it in the same save - blank is not a persistable state when a default exists. COUPLING: the entity strings in the Stamp_* assignments must stay in sync with the Account.PingCAP_Contracting_Entity__c picklist options, and the Region literals in Map_Region_To_Entity with the Account.Region__c picklist (both in objects/Account.json). A new Region value safely falls through to the Pte. Ltd. default; renaming a contracting entity requires updating the matching assignment here or the flow will stamp a value outside the picklist.",
  "processType": "AutoLaunchedFlow",
  "status": "Active",
  "start": {
    "object": "Account",
    "triggerType": "RecordBeforeSave",
    "recordTriggerType": "CreateAndUpdate",
    "filterLogic": "and",
    "filters": [
      {"field": "PingCAP_Contracting_Entity__c", "operator": "IsNull", "value": {"booleanValue": true}}
    ],
    "connector": {"targetReference": "Map_Region_To_Entity"}
  },
  "decisions": [
    {
      "name": "Map_Region_To_Entity",
      "label": "Map Region to PingCAP contracting entity",
      "locationX": 200,
      "locationY": 200,
      "rules": [
        {
          "name": "region_japan",
          "label": "Japan -> PingCAP Kabushiki-Kaisha",
          "conditionLogic": "and",
          "conditions": [
            {"leftValueReference": "$Record.Region__c", "operator": "EqualTo", "rightValue": {"stringValue": "Japan"}}
          ],
          "connector": {"targetReference": "Stamp_Japan"}
        },
        {
          "name": "region_na",
          "label": "NA -> PingCAP (US), Inc.",
          "conditionLogic": "and",
          "conditions": [
            {"leftValueReference": "$Record.Region__c", "operator": "EqualTo", "rightValue": {"stringValue": "NA"}}
          ],
          "connector": {"targetReference": "Stamp_US"}
        },
        {
          "name": "region_latam",
          "label": "LATAM -> PingCAP (US), Inc.",
          "conditionLogic": "and",
          "conditions": [
            {"leftValueReference": "$Record.Region__c", "operator": "EqualTo", "rightValue": {"stringValue": "LATAM"}}
          ],
          "connector": {"targetReference": "Stamp_US"}
        }
      ],
      "defaultConnector": {"targetReference": "Stamp_Singapore"},
      "defaultConnectorLabel": "APAC / EMEA / other -> PingCAP Pte. Ltd."
    }
  ],
  "assignments": [
    {
      "name": "Stamp_Japan",
      "label": "Stamp Contracting Entity = PingCAP Kabushiki-Kaisha",
      "locationX": 100,
      "locationY": 400,
      "assignmentItems": [
        {"assignToReference": "$Record.PingCAP_Contracting_Entity__c", "operator": "Assign", "value": {"stringValue": "PingCAP Kabushiki-Kaisha"}}
      ]
    },
    {
      "name": "Stamp_US",
      "label": "Stamp Contracting Entity = PingCAP (US), Inc.",
      "locationX": 300,
      "locationY": 400,
      "assignmentItems": [
        {"assignToReference": "$Record.PingCAP_Contracting_Entity__c", "operator": "Assign", "value": {"stringValue": "PingCAP (US), Inc."}}
      ]
    },
    {
      "name": "Stamp_Singapore",
      "label": "Stamp Contracting Entity = PingCAP Pte. Ltd.",
      "locationX": 500,
      "locationY": 400,
      "assignmentItems": [
        {"assignToReference": "$Record.PingCAP_Contracting_Entity__c", "operator": "Assign", "value": {"stringValue": "PingCAP Pte. Ltd."}}
      ]
    }
  ]
}
