<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <actionCalls>
        <name>Rejection_Email</name>
        <label>Rejection Email</label>
        <locationX>946</locationX>
        <locationY>564</locationY>
        <actionName>Lead.Artist_Rejection_Email</actionName>
        <actionType>emailAlert</actionType>
        <flowTransactionModel>CurrentTransaction</flowTransactionModel>
        <inputParameters>
            <name>SObjectRowId</name>
            <value>
                <elementReference>$Record.Id</elementReference>
            </value>
        </inputParameters>
        <nameSegment>Lead.Artist_Rejection_Email</nameSegment>
        <versionSegment>1</versionSegment>
    </actionCalls>
    <actionCalls>
        <name>Rejection_Email_0</name>
        <label>Rejection Email</label>
        <locationX>933</locationX>
        <locationY>50</locationY>
        <actionName>Lead.Artist_Rejection_Email</actionName>
        <actionType>emailAlert</actionType>
        <flowTransactionModel>CurrentTransaction</flowTransactionModel>
        <inputParameters>
            <name>SObjectRowId</name>
            <value>
                <elementReference>$Record.Id</elementReference>
            </value>
        </inputParameters>
        <nameSegment>Lead.Artist_Rejection_Email</nameSegment>
        <versionSegment>1</versionSegment>
    </actionCalls>
    <apiVersion>52.0</apiVersion>
    <decisions>
        <name>Run_after_24_hr_Delay</name>
        <label>Run after 24 hr Delay</label>
        <locationX>506</locationX>
        <locationY>186</locationY>
        <defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
        <rules>
            <name>External_Test_is_False</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>$Record.ExternalTest__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Update_The_Lead_Status_0</targetReference>
            </connector>
            <label>External Test is False</label>
        </rules>
    </decisions>
    <decisions>
        <name>Run_Immediately</name>
        <label>Run Immediately</label>
        <locationX>515</locationX>
        <locationY>413</locationY>
        <defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
        <rules>
            <name>External_Test_is_True</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>$Record.ExternalTest__c</leftValueReference>
                <operator>EqualTo</operator>
                <rightValue>
                    <booleanValue>true</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>Update_The_Lead_Status</targetReference>
            </connector>
            <label>External Test is True</label>
        </rules>
    </decisions>
    <interviewLabel>Automatic Rejection and Notification {!$Flow.CurrentDateTime}</interviewLabel>
    <label>Automatic Rejection and Notification</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>
    <recordUpdates>
        <name>Update_The_Lead_Status</name>
        <label>Update The Lead Status</label>
        <locationX>764</locationX>
        <locationY>484</locationY>
        <connector>
            <targetReference>Rejection_Email</targetReference>
        </connector>
        <inputAssignments>
            <field>Status</field>
            <value>
                <stringValue>Unqualified</stringValue>
            </value>
        </inputAssignments>
        <inputReference>$Record</inputReference>
    </recordUpdates>
    <recordUpdates>
        <name>Update_The_Lead_Status_0</name>
        <label>Update The Lead Status</label>
        <locationX>758</locationX>
        <locationY>116</locationY>
        <connector>
            <targetReference>Rejection_Email_0</targetReference>
        </connector>
        <inputAssignments>
            <field>Status</field>
            <value>
                <stringValue>Unqualified</stringValue>
            </value>
        </inputAssignments>
        <inputReference>$Record</inputReference>
    </recordUpdates>
    <start>
        <locationX>50</locationX>
        <locationY>221</locationY>
        <connector>
            <targetReference>Run_Immediately</targetReference>
        </connector>
        <doesRequireRecordChangedToMeetCriteria>true</doesRequireRecordChangedToMeetCriteria>
        <filterFormula>AND(
  {!$Record.RecordType.DeveloperName} = &quot;Artist_DIY_Lead&quot;,
  TEXT({!$Record.LeadScore__c}) = &quot;Reject&quot;,
  NOT($Permission.Admin_Bypass_Flows)
)</filterFormula>
        <object>Lead</object>
        <recordTriggerType>CreateAndUpdate</recordTriggerType>
        <scheduledPaths>
            <name>Delayed_Rejection_response</name>
            <connector>
                <targetReference>Run_after_24_hr_Delay</targetReference>
            </connector>
            <label>Delayed-Rejection response</label>
            <offsetNumber>24</offsetNumber>
            <offsetUnit>Hours</offsetUnit>
            <timeSource>RecordTriggerEvent</timeSource>
        </scheduledPaths>
        <triggerType>RecordAfterSave</triggerType>
    </start>
    <status>Active</status>
</Flow>
