{
  "apiVersion": 56,
  "decisions": [
    {
      "name": "if_Bigger_Date",
      "label": "if Bigger Date",
      "locationX": 578,
      "locationY": 468,
      "defaultConnectorLabel": "Default Outcome",
      "rules": [
        {
          "name": "all_not_null_and_start_date",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "Get_First_Order",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "Get_first_Close_Won_Opportunity",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "Get_First_Order.EffectiveDate",
              "operator": "LessThanOrEqualTo",
              "rightValue": {
                "elementReference": "Get_first_Close_Won_Opportunity.CloseDate"
              }
            },
            {
              "leftValueReference": "$Record.First_Order_Start_Date__c",
              "operator": "NotEqualTo",
              "rightValue": {
                "elementReference": "Get_First_Order.EffectiveDate"
              }
            }
          ],
          "connector": {
            "targetReference": "update_account"
          },
          "label": "all not null and start date"
        },
        {
          "name": "start_date_is_not_null_end_date_is_null",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "Get_First_Order",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "Get_first_Close_Won_Opportunity",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": true
              }
            },
            {
              "leftValueReference": "$Record.First_Order_Start_Date__c",
              "operator": "NotEqualTo",
              "rightValue": {
                "elementReference": "Get_First_Order.EffectiveDate"
              }
            }
          ],
          "connector": {
            "targetReference": "Copy_1_of_update_account"
          },
          "label": "start  date is not null end date is null"
        },
        {
          "name": "close_date_is_not_null_start_date_is_null",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "Get_first_Close_Won_Opportunity",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "Get_First_Order",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": true
              }
            },
            {
              "leftValueReference": "$Record.First_Order_Start_Date__c",
              "operator": "NotEqualTo",
              "rightValue": {
                "elementReference": "Get_first_Close_Won_Opportunity.CloseDate"
              }
            }
          ],
          "connector": {
            "targetReference": "Copy_2_of_update_account"
          },
          "label": "close date is not null start date is null"
        },
        {
          "name": "all_not_null_and_close_date",
          "conditionLogic": "and",
          "conditions": [
            {
              "leftValueReference": "Get_first_Close_Won_Opportunity",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "Get_First_Order",
              "operator": "IsNull",
              "rightValue": {
                "booleanValue": false
              }
            },
            {
              "leftValueReference": "Get_first_Close_Won_Opportunity.CloseDate",
              "operator": "LessThan",
              "rightValue": {
                "elementReference": "Get_First_Order.EffectiveDate"
              }
            },
            {
              "leftValueReference": "$Record.First_Order_Start_Date__c",
              "operator": "NotEqualTo",
              "rightValue": {
                "elementReference": "Get_first_Close_Won_Opportunity.CloseDate"
              }
            }
          ],
          "connector": {
            "targetReference": "Copy_3_of_update_account"
          },
          "label": "all not null and close date"
        }
      ]
    }
  ],
  "label": "Account First Order Start Date Update",
  "processType": "AutoLaunchedFlow",
  "recordLookups": [
    {
      "name": "Get_first_Close_Won_Opportunity",
      "label": "Get first Close Won Opportunity",
      "locationX": 578,
      "locationY": 360,
      "assignNullValuesIfNoRecordsFound": false,
      "connector": {
        "targetReference": "if_Bigger_Date"
      },
      "filterLogic": "and",
      "filters": [
        {
          "field": "AccountId",
          "operator": "EqualTo",
          "value": {
            "elementReference": "$Record.Id"
          }
        },
        {
          "field": "StageName",
          "operator": "EqualTo",
          "value": {
            "stringValue": "Closed Won"
          }
        }
      ],
      "getFirstRecordOnly": true,
      "object": "Opportunity",
      "sortField": "CloseDate",
      "sortOrder": "Asc",
      "storeOutputAutomatically": true
    },
    {
      "name": "Get_First_Order",
      "label": "Get First Order",
      "locationX": 578,
      "locationY": 252,
      "assignNullValuesIfNoRecordsFound": false,
      "connector": {
        "targetReference": "Get_first_Close_Won_Opportunity"
      },
      "filterLogic": "and",
      "filters": [
        {
          "field": "AccountId",
          "operator": "EqualTo",
          "value": {
            "elementReference": "$Record.Id"
          }
        },
        {
          "field": "Status",
          "operator": "EqualTo",
          "value": {
            "stringValue": "Activated"
          }
        }
      ],
      "getFirstRecordOnly": true,
      "object": "Order",
      "sortField": "EffectiveDate",
      "sortOrder": "Asc",
      "storeOutputAutomatically": true
    }
  ],
  "recordUpdates": [
    {
      "name": "Copy_1_of_update_account",
      "label": "Copy 1 of update account",
      "locationX": 314,
      "locationY": 576,
      "inputAssignments": [
        {
          "field": "First_Order_Start_Date__c",
          "value": {
            "elementReference": "Get_First_Order.EffectiveDate"
          }
        }
      ],
      "inputReference": "$Record"
    },
    {
      "name": "Copy_2_of_update_account",
      "label": "Copy 2 of update account",
      "locationX": 578,
      "locationY": 576,
      "inputAssignments": [
        {
          "field": "First_Order_Start_Date__c",
          "value": {
            "elementReference": "Get_first_Close_Won_Opportunity.CloseDate"
          }
        }
      ],
      "inputReference": "$Record"
    },
    {
      "name": "Copy_3_of_update_account",
      "label": "Copy 3 of update account",
      "locationX": 842,
      "locationY": 576,
      "inputAssignments": [
        {
          "field": "First_Order_Start_Date__c",
          "value": {
            "elementReference": "Get_first_Close_Won_Opportunity.CloseDate"
          }
        }
      ],
      "inputReference": "$Record"
    },
    {
      "name": "update_account",
      "label": "update account",
      "locationX": 50,
      "locationY": 576,
      "inputAssignments": [
        {
          "field": "First_Order_Start_Date__c",
          "value": {
            "elementReference": "Get_First_Order.EffectiveDate"
          }
        }
      ],
      "inputReference": "$Record"
    }
  ],
  "start": {
    "locationX": 452,
    "locationY": 0,
    "connector": {
      "targetReference": "Get_First_Order"
    },
    "object": "Account",
    "schedule": {
      "frequency": "Daily",
      "startDate": "2023-02-01",
      "startTime": "00:00:00.000Z"
    },
    "triggerType": "Scheduled"
  },
  "status": "Active"
}
