{
  "apiVersion": 55,
  "areMetricsLoggedToDataCloud": false,
  "assignments": [
    {
      "name": "Lead_Update_Obj",
      "label": "Lead Update Obj",
      "locationX": 50,
      "locationY": 575,
      "assignmentItems": [
        {
          "assignToReference": "contactobj.Id",
          "operator": "Assign",
          "value": {
            "elementReference": "$Record.ContactId"
          }
        },
        {
          "assignToReference": "contactobj.First_Campaign__c",
          "operator": "Assign",
          "value": {
            "elementReference": "Get_first_CampaignMember.CampaignId"
          }
        }
      ],
      "connector": {
        "targetReference": "Get_last_CampaignMember"
      }
    },
    {
      "name": "Lead_Update_Obj_0",
      "label": "Lead Update Obj",
      "locationX": 50,
      "locationY": 1031,
      "assignmentItems": [
        {
          "assignToReference": "contactobj.Id",
          "operator": "Assign",
          "value": {
            "elementReference": "$Record.ContactId"
          }
        },
        {
          "assignToReference": "contactobj.Last_Campaign__c",
          "operator": "Assign",
          "value": {
            "elementReference": "Get_last_CampaignMember.CampaignId"
          }
        }
      ],
      "connector": {
        "targetReference": "if_lead_not_null"
      }
    },
    {
      "name": "Lead_Update_Obj_0_0",
      "label": "Lead Update Obj",
      "locationX": 314,
      "locationY": 575,
      "assignmentItems": [
        {
          "assignToReference": "contactobj.Id",
          "operator": "Assign",
          "value": {
            "elementReference": "$Record.ContactId"
          }
        },
        {
          "assignToReference": "contactobj.First_Campaign__c",
          "operator": "Assign"
        }
      ],
      "connector": {
        "targetReference": "Get_last_CampaignMember"
      }
    },
    {
      "name": "Lead_Update_Obj_0_0_0",
      "label": "Lead Update Obj",
      "locationX": 314,
      "locationY": 1031,
      "assignmentItems": [
        {
          "assignToReference": "contactobj.Id",
          "operator": "Assign",
          "value": {
            "elementReference": "$Record.ContactId"
          }
        },
        {
          "assignToReference": "contactobj.Last_Campaign__c",
          "operator": "Assign"
        }
      ],
      "connector": {
        "targetReference": "if_lead_not_null"
      }
    }
  ],
  "decisions": [
    {
      "name": "Skip_Lead_Convert_Relink",
      "label": "Skip Lead Convert relink recompute",
      "locationX": 56,
      "locationY": 150,
      "defaultConnector": {
        "targetReference": "SkipConnectorInboundCampaignDerived"
      },
      "defaultConnectorLabel": "Normal Contact CampaignMember change",
      "rules": [
        {
          "name": "lead_to_contact_relink",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "$Record__Prior",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "$Record__Prior.LeadId",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "$Record__Prior.ContactId",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": true
              }
            },
            {
              "leftValueReference": "$Record.LeadId",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": true
              }
            },
            {
              "leftValueReference": "$Record.ContactId",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            }
          ],
          "label": "Lead Convert relink"
        }
      ]
    },
    {
      "name": "SkipConnectorInboundCampaignDerived",
      "label": "Skip connector inbound Campaign derived maintenance",
      "locationX": 40,
      "locationY": 80,
      "defaultConnector": {
        "targetReference": "Get_first_CampaignMember"
      },
      "defaultConnectorLabel": "User or non-HubSpot CampaignMember change",
      "rules": [
        {
          "name": "HubSpotConnectorInbound",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "$SystemContext.ConnectorSyncOrigin",
              "operator": "EqualTo",
              "rightValue": {
                "stringValue": "hubspot-crm-connector"
              }
            }
          ],
          "label": "HubSpot connector inbound"
        }
      ]
    },
    {
      "name": "IF_First_CampaignMember_Is_null",
      "label": "IF First CampaignMember  Is null",
      "locationX": 182,
      "locationY": 455,
      "defaultConnector": {
        "targetReference": "Lead_Update_Obj_0_0"
      },
      "defaultConnectorLabel": "Default Outcome",
      "rules": [
        {
          "name": "first_not_null",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "Get_first_CampaignMember",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            }
          ],
          "connector": {
            "targetReference": "Lead_Update_Obj"
          },
          "label": "first not null"
        }
      ]
    },
    {
      "name": "IF_Last_CampaignMember_Is_null",
      "label": "IF Last CampaignMember  Is null",
      "locationX": 182,
      "locationY": 911,
      "defaultConnector": {
        "targetReference": "Lead_Update_Obj_0_0_0"
      },
      "defaultConnectorLabel": "Default Outcome",
      "rules": [
        {
          "name": "last_not_null",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "Get_last_CampaignMember",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            }
          ],
          "connector": {
            "targetReference": "Lead_Update_Obj_0"
          },
          "label": "last not null"
        }
      ]
    },
    {
      "name": "if_lead_not_null",
      "label": "if lead not null",
      "locationX": 182,
      "locationY": 1247,
      "defaultConnectorLabel": "Default Outcome",
      "rules": [
        {
          "name": "notnull",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "contactobj.Id",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            }
          ],
          "connector": {
            "targetReference": "update_lead"
          },
          "label": "notnull"
        }
      ]
    }
  ],
  "label": "Contact Set First And Last CampaignMember",
  "processType": "AutoLaunchedFlow",
  "recordLookups": [
    {
      "name": "Get_first_CampaignMember",
      "label": "Get first CampaignMember",
      "locationX": 182,
      "locationY": 335,
      "assignNullValuesIfNoRecordsFound": false,
      "connector": {
        "targetReference": "IF_First_CampaignMember_Is_null"
      },
      "filterLogic": "and",
      "filters": [
        {
          "field": "ContactId",
          "operator": "EqualTo",
          "value": {
            "elementReference": "$Record.ContactId"
          }
        },
        {
          "field": "Campaign_Name__c",
          "operator": "NotEqualTo",
          "value": {
            "stringValue": "OP - Person Lifecycle Campaign"
          }
        }
      ],
      "getFirstRecordOnly": true,
      "object": "CampaignMember",
      "queriedFields": [
        "Id",
        "CampaignId"
      ],
      "sortField": "CreatedDate",
      "sortOrder": "Asc",
      "storeOutputAutomatically": true
    },
    {
      "name": "Get_last_CampaignMember",
      "label": "Get last CampaignMember",
      "locationX": 182,
      "locationY": 791,
      "assignNullValuesIfNoRecordsFound": false,
      "connector": {
        "targetReference": "IF_Last_CampaignMember_Is_null"
      },
      "filterLogic": "and",
      "filters": [
        {
          "field": "ContactId",
          "operator": "EqualTo",
          "value": {
            "elementReference": "$Record.ContactId"
          }
        },
        {
          "field": "Campaign_Name__c",
          "operator": "NotEqualTo",
          "value": {
            "stringValue": "OP - Person Lifecycle Campaign"
          }
        }
      ],
      "getFirstRecordOnly": true,
      "object": "CampaignMember",
      "queriedFields": [
        "Id",
        "CampaignId"
      ],
      "sortField": "CreatedDate",
      "sortOrder": "Desc",
      "storeOutputAutomatically": true
    }
  ],
  "recordUpdates": [
    {
      "name": "update_lead",
      "label": "update lead",
      "locationX": 50,
      "locationY": 1367,
      "object": "Contact",
      "filterLogic": "and",
      "filters": [
        {
          "field": "Id",
          "operator": "EqualTo",
          "value": {
            "elementReference": "contactobj.Id"
          }
        }
      ],
      "inputAssignments": [
        {
          "field": "First_Campaign__c",
          "value": {
            "elementReference": "contactobj.First_Campaign__c"
          }
        },
        {
          "field": "Last_Campaign__c",
          "value": {
            "elementReference": "contactobj.Last_Campaign__c"
          }
        }
      ]
    }
  ],
  "start": {
    "locationX": 56,
    "locationY": 0,
    "connector": {
      "targetReference": "Skip_Lead_Convert_Relink"
    },
    "filterLogic": "and",
    "filters": [
      {
        "field": "ContactId",
        "operator": "IsNull",
        "value": {
          "booleanValue": false
        }
      },
      {
        "field": "Campaign_Name__c",
        "operator": "NotEqualTo",
        "value": {
          "stringValue": "OP - Person Lifecycle Campaign"
        }
      }
    ],
    "object": "CampaignMember",
    "recordTriggerType": "CreateAndUpdate",
    "triggerType": "RecordAfterSave"
  },
  "status": "Active",
  "variables": [
    {
      "name": "contactobj",
      "dataType": "SObject",
      "isCollection": false,
      "isInput": true,
      "isOutput": true,
      "objectType": "Contact"
    },
    {
      "name": "leadobj",
      "dataType": "SObject",
      "isCollection": false,
      "isInput": true,
      "isOutput": true,
      "objectType": "Lead"
    }
  ],
  "description": "Skips the Contact first/last CampaignMember recompute when Std_RelinkLeadChildren converts an existing Lead CampaignMember into a Contact CampaignMember. Lead Convert already copies First_Campaign__c and Last_Campaign__c through Lead->Contact field mapping, so the relink path should only reparent the child and avoid the wide CampaignMember lookup."
}
