<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <actionCalls>
        <name>Send_Email</name>
        <label>Send Email</label>
        <locationX>443</locationX>
        <locationY>167</locationY>
        <actionName>emailSimple</actionName>
        <actionType>emailSimple</actionType>
        <connector>
            <targetReference>endScreen</targetReference>
        </connector>
        <inputParameters>
            <name>emailBody</name>
            <value>
                <elementReference>emailBody</elementReference>
            </value>
        </inputParameters>
        <inputParameters>
            <name>emailAddresses</name>
            <value>
                <elementReference>selectedUserEmail</elementReference>
            </value>
        </inputParameters>
        <inputParameters>
            <name>emailSubject</name>
            <value>
                <stringValue>Request for New Account</stringValue>
            </value>
        </inputParameters>
        <nameSegment>emailSimple</nameSegment>
        <versionSegment>1</versionSegment>
    </actionCalls>
    <apiVersion>50.0</apiVersion>
    <choices>
        <name>Advertiser</name>
        <choiceText>Advertiser</choiceText>
        <dataType>String</dataType>
        <value>
            <stringValue>Advertiser</stringValue>
        </value>
    </choices>
    <choices>
        <name>Agency</name>
        <choiceText>Agency</choiceText>
        <dataType>String</dataType>
        <value>
            <stringValue>Agency</stringValue>
        </value>
    </choices>
    <choices>
        <name>Sub_Advertiser</name>
        <choiceText>Sub-Advertiser</choiceText>
        <dataType>String</dataType>
        <value>
            <stringValue>Sub-Advertiser</stringValue>
        </value>
    </choices>
    <choices>
        <name>Sub_Agency</name>
        <choiceText>Sub-Agency</choiceText>
        <dataType>String</dataType>
        <value>
            <stringValue>Sub-Agency</stringValue>
        </value>
    </choices>
    <dynamicChoiceSets>
        <name>usersList</name>
        <dataType>String</dataType>
        <displayField>Name</displayField>
        <object>User</object>
        <outputAssignments>
            <assignToReference>selectedUserEmail</assignToReference>
            <field>Email</field>
        </outputAssignments>
        <outputAssignments>
            <assignToReference>selectedUserFirstName</assignToReference>
            <field>FirstName</field>
        </outputAssignments>
        <valueField>Name</valueField>
    </dynamicChoiceSets>
    <interviewLabel>Create Account from Opportunity {!$Flow.CurrentDateTime}</interviewLabel>
    <label>Create Account from Opportunity</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>Flow</processType>
    <screens>
        <name>endScreen</name>
        <label>endScreen</label>
        <locationX>608</locationX>
        <locationY>183</locationY>
        <allowBack>false</allowBack>
        <allowFinish>true</allowFinish>
        <allowPause>false</allowPause>
        <fields>
            <name>message</name>
            <fieldText>&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Congratulations!!!&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;Your request for new Account creation has been submitted successfully. &lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;Thanks!&lt;/span&gt;&lt;/p&gt;</fieldText>
            <fieldType>DisplayText</fieldType>
        </fields>
        <showFooter>true</showFooter>
        <showHeader>true</showHeader>
    </screens>
    <screens>
        <name>testscreen</name>
        <label>testscreen</label>
        <locationX>200</locationX>
        <locationY>211</locationY>
        <allowBack>true</allowBack>
        <allowFinish>true</allowFinish>
        <allowPause>false</allowPause>
        <connector>
            <targetReference>Send_Email</targetReference>
        </connector>
        <fields>
            <name>Account_Name</name>
            <dataType>String</dataType>
            <fieldText>Account Name</fieldText>
            <fieldType>InputField</fieldType>
            <isRequired>true</isRequired>
        </fields>
        <fields>
            <name>Type_of_Account</name>
            <choiceReferences>Advertiser</choiceReferences>
            <choiceReferences>Sub_Advertiser</choiceReferences>
            <choiceReferences>Agency</choiceReferences>
            <choiceReferences>Sub_Agency</choiceReferences>
            <dataType>String</dataType>
            <fieldText>Type of Account</fieldText>
            <fieldType>DropdownBox</fieldType>
            <isRequired>true</isRequired>
        </fields>
        <fields>
            <name>Select_User_to_send_Email</name>
            <choiceReferences>usersList</choiceReferences>
            <dataType>String</dataType>
            <fieldText>Select User to send Email</fieldText>
            <fieldType>DropdownBox</fieldType>
            <isRequired>true</isRequired>
        </fields>
        <showFooter>true</showFooter>
        <showHeader>true</showHeader>
    </screens>
    <start>
        <locationX>50</locationX>
        <locationY>50</locationY>
        <connector>
            <targetReference>testscreen</targetReference>
        </connector>
    </start>
    <status>Active</status>
    <textTemplates>
        <name>emailBody</name>
        <isViewedAsPlainText>true</isViewedAsPlainText>
        <text>Hi {!selectedUserFirstName},
Please create new account as per following details:
Account Name: {!Account_Name}
Account Type: {!Type_of_Account}

Thanks and Regards</text>
    </textTemplates>
    <variables>
        <name>selectedUserEmail</name>
        <dataType>String</dataType>
        <isCollection>false</isCollection>
        <isInput>false</isInput>
        <isOutput>false</isOutput>
    </variables>
    <variables>
        <name>selectedUserFirstName</name>
        <dataType>String</dataType>
        <isCollection>false</isCollection>
        <isInput>false</isInput>
        <isOutput>false</isOutput>
    </variables>
</Flow>
