<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <actionCalls>
        <name>Change_Cadence_Target_Assignee</name>
        <label>Change Cadence Target Assignee</label>
        <locationX>0</locationX>
        <locationY>0</locationY>
        <actionName>changeSalesCadenceTargetAssignee</actionName>
        <actionType>changeSalesCadenceTargetAssignee</actionType>
        <faultConnector>
            <targetReference>Set_Cadence_Target_Error</targetReference>
        </faultConnector>
        <flowTransactionModel>CurrentTransaction</flowTransactionModel>
        <inputParameters>
            <name>targetId</name>
            <value>
                <elementReference>targetId</elementReference>
            </value>
        </inputParameters>
        <inputParameters>
            <name>userId</name>
            <value>
                <elementReference>userId</elementReference>
            </value>
        </inputParameters>
        <inputParameters>
            <name>shouldApplyUserContext</name>
            <value>
                <elementReference>shouldApplyUserContext</elementReference>
            </value>
        </inputParameters>
        <storeOutputAutomatically>true</storeOutputAutomatically>
    </actionCalls>
    <actionCalls>
        <name>ChangeCadenceTargetAssigneeByCadenceTrackerId</name>
        <label>Change Cadence Target Assignee By CadenceTrackerId</label>
        <locationX>0</locationX>
        <locationY>0</locationY>
        <actionName>changeSalesCadenceTargetAssignee</actionName>
        <actionType>changeSalesCadenceTargetAssignee</actionType>
        <faultConnector>
            <targetReference>Set_Cadence_Tracker_Error</targetReference>
        </faultConnector>
        <flowTransactionModel>CurrentTransaction</flowTransactionModel>
        <inputParameters>
            <name>actionCadenceTrackerId</name>
            <value>
                <elementReference>actionCadenceTrackerId</elementReference>
            </value>
        </inputParameters>
        <inputParameters>
            <name>userId</name>
            <value>
                <elementReference>userId</elementReference>
            </value>
        </inputParameters>
        <storeOutputAutomatically>true</storeOutputAutomatically>
    </actionCalls>
    <apiVersion>64.0</apiVersion>
    <assignments>
        <name>Set_Cadence_Target_Error</name>
        <label>Set Cadence Target Error</label>
        <locationX>0</locationX>
        <locationY>0</locationY>
        <assignmentItems>
            <assignToReference>errorMessage</assignToReference>
            <operator>Assign</operator>
            <value>
                <elementReference>Change_Cadence_Target_Assignee.error</elementReference>
            </value>
        </assignmentItems>
    </assignments>
    <assignments>
        <name>Set_Cadence_Tracker_Error</name>
        <label>Set Cadence Tracker Error</label>
        <locationX>0</locationX>
        <locationY>0</locationY>
        <assignmentItems>
            <assignToReference>errorMessage</assignToReference>
            <operator>Assign</operator>
            <value>
                <elementReference>ChangeCadenceTargetAssigneeByCadenceTrackerId.error</elementReference>
            </value>
        </assignmentItems>
    </assignments>
    <decisions>
        <name>Variables</name>
        <label>Variables</label>
        <locationX>0</locationX>
        <locationY>0</locationY>
        <defaultConnector>
            <targetReference>Change_Cadence_Target_Assignee</targetReference>
        </defaultConnector>
        <defaultConnectorLabel>Target</defaultConnectorLabel>
        <rules>
            <name>CadenceTracker</name>
            <conditionLogic>and</conditionLogic>
            <conditions>
                <leftValueReference>actionCadenceTrackerId</leftValueReference>
                <operator>IsBlank</operator>
                <rightValue>
                    <booleanValue>false</booleanValue>
                </rightValue>
            </conditions>
            <connector>
                <targetReference>ChangeCadenceTargetAssigneeByCadenceTrackerId</targetReference>
            </connector>
            <label>CadenceTracker</label>
        </rules>
    </decisions>
    <environments>Default</environments>
    <interviewLabel>RemoveTargetFromSalesCadence {!$Flow.CurrentDateTime}</interviewLabel>
    <label>ChangeSalesCadenceTargetAssignee</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>
    <start>
        <locationX>0</locationX>
        <locationY>0</locationY>
        <connector>
            <targetReference>Variables</targetReference>
        </connector>
    </start>
    <status>Active</status>
    <variables>
        <name>actionCadenceTrackerId</name>
        <dataType>String</dataType>
        <isCollection>false</isCollection>
        <isInput>true</isInput>
        <isOutput>false</isOutput>
    </variables>
    <variables>
        <name>errorMessage</name>
        <dataType>String</dataType>
        <isCollection>false</isCollection>
        <isInput>false</isInput>
        <isOutput>true</isOutput>
    </variables>
    <variables>
        <name>shouldApplyUserContext</name>
        <dataType>Boolean</dataType>
        <isCollection>false</isCollection>
        <isInput>true</isInput>
        <isOutput>false</isOutput>
    </variables>
    <variables>
        <description>The ID of the contact, a lead, or person account to change the the Cadence&apos;s assignee.</description>
        <name>targetId</name>
        <dataType>String</dataType>
        <isCollection>false</isCollection>
        <isInput>true</isInput>
        <isOutput>false</isOutput>
    </variables>
    <variables>
        <description>The ID of the user to whom assign the Cadence.</description>
        <name>userId</name>
        <dataType>String</dataType>
        <isCollection>false</isCollection>
        <isInput>true</isInput>
        <isOutput>false</isOutput>
    </variables>
</Flow>
