<?xml version="1.0" encoding="UTF-8" ?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>60.0</apiVersion>
    <decisions>
        <name>Check_Status</name>
        <label>Check Status</label>
        <locationX>710</locationX>
        <locationY>887</locationY>
        <defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
        <rules>
            <name>Request_Received</name>
            <conditionLogic>or</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>Request Received</stringValue>
                </rightValue>
            </conditions>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>Request Sent for Approval</stringValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Update_Request_Received</targetReference>
            </connector>
            <label>Request Received</label>
        </rules>
        <rules>
            <name>Approved</name>
            <conditionLogic>or</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue
                    >Approved; AWAL Awaiting Confirmation of Use</stringValue>
                </rightValue>
            </conditions>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>Confirmed; AWAL to issue License</stringValue>
                </rightValue>
            </conditions>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>Confirmed; LR Not Yet Received</stringValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Update_Approved</targetReference>
            </connector>
            <label>Approved</label>
        </rules>
        <rules>
            <name>License_Issued</name>
            <conditionLogic>or</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>License Issued; AWAL Awaiting PE</stringValue>
                </rightValue>
            </conditions>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue
                    >License Issued; Licensee Seeking Amendments</stringValue>
                </rightValue>
            </conditions>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>PE Received</stringValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Update_License_Issued</targetReference>
            </connector>
            <label>License Issued</label>
        </rules>
        <rules>
            <name>Complete</name>
            <conditionLogic>or</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>FE Issued; Completed</stringValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Update_Complete</targetReference>
            </connector>
            <label>Complete</label>
        </rules>
        <rules>
            <name>Confirmed_Not_used</name>
            <conditionLogic>or</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>Confirmed Not Used</stringValue>
                </rightValue>
            </conditions>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <stringValue>Denied</stringValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Update_Confirmed_Not_Used</targetReference>
            </connector>
            <label>Confirmed Not used</label>
        </rules>
    </decisions>
    <decisions>
        <name>License_Status_Changed</name>
        <label>License Status Changed?</label>
        <locationX>534</locationX>
        <locationY>503</locationY>
        <defaultConnectorLabel>No</defaultConnectorLabel>
        <rules>
            <name>Yes</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference
                >$Record.LicenseStatus__c</leftValueReference>
                <operator>IsChanged</operator>
                <rightValue>
                    <booleanValue>true</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Check_Status</targetReference>
            </connector>
            <label>Yes</label>
        </rules>
    </decisions>
    <decisions>
        <name>New_Synch_Dealtracker_Record</name>
        <label>New Synch Dealtracker Record?</label>
        <locationX>710</locationX>
        <locationY>395</locationY>
        <defaultConnector>
            <targetReference>Check_Status</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>License_Status_Changed</targetReference>
            </connector>
            <label>No</label>
        </rules>
    </decisions>
    <environments>Default</environments>
    <interviewLabel
    >Synch Dealtracker - Update Path {!$Flow.CurrentDateTime}</interviewLabel>
    <label>Synch Dealtracker - Update Path</label>
    <processMetadataValues>
        <name>BuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>CanvasMode</name>
        <value>
            <stringValue>AUTO_LAYOUT_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>710</locationX>
        <locationY>287</locationY>
        <assignNullValuesIfNoRecordsFound
        >false</assignNullValuesIfNoRecordsFound>
        <connector>
            <targetReference>New_Synch_Dealtracker_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>
    <recordUpdates>
        <name>Update_Approved</name>
        <label>Update Approved</label>
        <locationX>314</locationX>
        <locationY>995</locationY>
        <inputAssignments>
            <field>LicenseStatusPath__c</field>
            <value>
                <stringValue>Approved</stringValue>
            </value>
        </inputAssignments>
        <inputReference>$Record</inputReference>
    </recordUpdates>
    <recordUpdates>
        <name>Update_Complete</name>
        <label>Update Complete</label>
        <locationX>842</locationX>
        <locationY>995</locationY>
        <inputAssignments>
            <field>LicenseStatusPath__c</field>
            <value>
                <stringValue>Complete</stringValue>
            </value>
        </inputAssignments>
        <inputReference>$Record</inputReference>
    </recordUpdates>
    <recordUpdates>
        <name>Update_Confirmed_Not_Used</name>
        <label>Update Confirmed Not Used</label>
        <locationX>1106</locationX>
        <locationY>995</locationY>
        <inputAssignments>
            <field>LicenseStatusPath__c</field>
            <value>
                <stringValue>Confirmed Not used</stringValue>
            </value>
        </inputAssignments>
        <inputReference>$Record</inputReference>
    </recordUpdates>
    <recordUpdates>
        <name>Update_License_Issued</name>
        <label>Update License Issued</label>
        <locationX>578</locationX>
        <locationY>995</locationY>
        <inputAssignments>
            <field>LicenseStatusPath__c</field>
            <value>
                <stringValue>License Issued</stringValue>
            </value>
        </inputAssignments>
        <inputReference>$Record</inputReference>
    </recordUpdates>
    <recordUpdates>
        <name>Update_Request_Received</name>
        <label>Update Request Received</label>
        <locationX>50</locationX>
        <locationY>995</locationY>
        <inputAssignments>
            <field>LicenseStatusPath__c</field>
            <value>
                <stringValue>Request Received</stringValue>
            </value>
        </inputAssignments>
        <inputReference>$Record</inputReference>
    </recordUpdates>
    <start>
        <locationX>584</locationX>
        <locationY>0</locationY>
        <connector>
            <targetReference>Pre_existing_Records</targetReference>
        </connector>
        <object>SynchClearance__c</object>
        <recordTriggerType>CreateAndUpdate</recordTriggerType>
        <triggerType>RecordBeforeSave</triggerType>
    </start>
    <status>Active</status>
</Flow>
