<?xml version="1.0" encoding="UTF-8" ?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>60.0</apiVersion>
    <assignments>
        <name>Set_Air_Date_Field</name>
        <label>Set Air Date Field</label>
        <locationX>1543</locationX>
        <locationY>1018</locationY>
        <assignmentItems>
            <assignToReference>$Record.AirDate__c</assignToReference>
            <operator>Assign</operator>
            <value>
                <elementReference>$Record.TermStartDate__c</elementReference>
            </value>
        </assignmentItems>
    </assignments>
    <assignments>
        <name>Update_Air_Date_field</name>
        <label>Update Air Date field</label>
        <locationX>1910</locationX>
        <locationY>855</locationY>
        <assignmentItems>
            <assignToReference>$Record.AirDate__c</assignToReference>
            <operator>Assign</operator>
            <value>
                <elementReference>$Record.TermStartDate__c</elementReference>
            </value>
        </assignmentItems>
    </assignments>
    <decisions>
        <name>Air_date_Populated</name>
        <label>Air date Populated</label>
        <locationX>1539</locationX>
        <locationY>852</locationY>
        <defaultConnector>
            <targetReference>Set_Air_Date_Field</targetReference>
        </defaultConnector>
        <defaultConnectorLabel>No</defaultConnectorLabel>
        <rules>
            <name>Yes3</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>$Record.AirDate__c</leftValueReference>
                <operator>IsNull</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <label>Yes</label>
        </rules>
    </decisions>
    <decisions>
        <name>Air_date_Populated2</name>
        <label>Air date Populated?</label>
        <locationX>1914</locationX>
        <locationY>643</locationY>
        <defaultConnector>
            <targetReference>Update_Air_Date_field</targetReference>
        </defaultConnector>
        <defaultConnectorLabel>No</defaultConnectorLabel>
        <rules>
            <name>Yes2</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>$Record.AirDate__c</leftValueReference>
                <operator>IsNull</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <label>Yes</label>
        </rules>
    </decisions>
    <decisions>
        <name>New_Synch_Clearance_Record</name>
        <label>New Synch Clearance Record?</label>
        <locationX>1536</locationX>
        <locationY>451</locationY>
        <defaultConnector>
            <targetReference>Start_Date_Populated</targetReference>
        </defaultConnector>
        <defaultConnectorLabel>Yes</defaultConnectorLabel>
        <rules>
            <name>No</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>Pre_Existing_Records</leftValueReference>
                <operator>IsNull</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Start_Date_Changed</targetReference>
            </connector>
            <label>No</label>
        </rules>
    </decisions>
    <decisions>
        <name>Start_Date_Changed</name>
        <label>Start Date Changed?</label>
        <locationX>1926</locationX>
        <locationY>446</locationY>
        <defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
        <rules>
            <name>Yes</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.TermStartDate__c</leftValueReference>
                <operator>IsChanged</operator>
                <rightValue>
                    <booleanValue>true</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Air_date_Populated2</targetReference>
            </connector>
            <label>Yes</label>
        </rules>
    </decisions>
    <decisions>
        <name>Start_Date_Populated</name>
        <label>Start Date Populated?</label>
        <locationX>1539</locationX>
        <locationY>687</locationY>
        <defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
        <rules>
            <name>yes4</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.TermStartDate__c</leftValueReference>
                <operator>IsNull</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Air_date_Populated</targetReference>
            </connector>
            <label>Yes</label>
        </rules>
    </decisions>
    <environments>Default</environments>
    <interviewLabel
    >Synch Clearence - Update Air Date field {!$Flow.CurrentDateTime}</interviewLabel>
    <label>Synch Clearance - Update Air Date field</label>
    <processMetadataValues>
        <name>BuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>CanvasMode</name>
        <value>
            <stringValue>FREE_FORM_CANVAS</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>OriginBuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processType>AutoLaunchedFlow</processType>
    <recordLookups>
        <name>Pre_Existing_Records</name>
        <label>Pre Existing Records</label>
        <locationX>1240</locationX>
        <locationY>445</locationY>
        <assignNullValuesIfNoRecordsFound
        >false</assignNullValuesIfNoRecordsFound>
        <connector>
            <targetReference>New_Synch_Clearance_Record</targetReference>
        </connector>
        <filterLogic>and</filterLogic>
        <filters>
            <field>Id</field>
            <operator>EqualTo</operator>
            <value>
                <elementReference>$Record.Id</elementReference>
            </value>
        </filters>
        <getFirstRecordOnly>true</getFirstRecordOnly>
        <object>SynchClearance__c</object>
        <storeOutputAutomatically>true</storeOutputAutomatically>
    </recordLookups>
    <start>
        <locationX>1112</locationX>
        <locationY>48</locationY>
        <connector>
            <targetReference>Pre_Existing_Records</targetReference>
        </connector>
        <object>SynchClearance__c</object>
        <recordTriggerType>CreateAndUpdate</recordTriggerType>
        <triggerType>RecordBeforeSave</triggerType>
    </start>
    <status>Obsolete</status>
</Flow>
