fix: reorder V3 Flow XML elements - group same types together

Salesforce requires elements of the same type (recordLookups, decisions,
screens, etc.) to be grouped together. Reordered all elements alphabetically
by type to comply with Flow metadata schema.
This commit is contained in:
Paul Huliganga 2026-02-25 11:06:40 -05:00
parent 19852fd4bb
commit ace2518349
1 changed files with 310 additions and 362 deletions

View File

@ -1,96 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata"> <Flow xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>60.0</apiVersion> <actionCalls>
<areMetricsLoggedToDataCloud>false</areMetricsLoggedToDataCloud> <name>Send_Composite_Envelope</name>
<environments>Default</environments> <label>Send Composite Envelope</label>
<interviewLabel>Docusign Envelope Templates V3 {!$Flow.CurrentDateTime}</interviewLabel> <locationX>50</locationX>
<label>Docusign Envelope Templates V3</label> <locationY>1000</locationY>
<processType>Flow</processType> <actionName>DocusignCompositeEnvelopeBuilder</actionName>
<status>Draft</status> <actionType>apex</actionType>
<!-- ==================== VARIABLES ==================== -->
<!-- Input: Record ID from the Client Case -->
<variables>
<name>recordId</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>
<!-- Text Collection: Holds Docusign template IDs from selected rows -->
<variables>
<name>compositeTemplateIds</name>
<dataType>String</dataType>
<isCollection>true</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<!-- Output from composite envelope action -->
<variables>
<name>envelopeId</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<variables>
<name>envelopeSuccess</name>
<dataType>Boolean</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<variables>
<name>envelopeErrorMessage</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<!-- ==================== START ==================== -->
<start>
<locationX>254</locationX>
<locationY>0</locationY>
<connector> <connector>
<targetReference>Get_Records</targetReference> <targetReference>Check_Envelope_Result</targetReference>
</connector> </connector>
</start> <flowTransactionModel>Automatic</flowTransactionModel>
<inputParameters>
<!-- ==================== STEP 1: Get Client Case Record ==================== --> <name>templateIds</name>
<value>
<recordLookups> <elementReference>compositeTemplateIds</elementReference>
<name>Get_Records</name> </value>
<label>Get Records</label> </inputParameters>
<locationX>380</locationX> <inputParameters>
<locationY>134</locationY> <name>recordId</name>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>Is_Language_Selected</targetReference>
</connector>
<filterLogic>and</filterLogic>
<filters>
<field>Id</field>
<operator>EqualTo</operator>
<value> <value>
<elementReference>recordId</elementReference> <elementReference>recordId</elementReference>
</value> </value>
</filters> </inputParameters>
<getFirstRecordOnly>true</getFirstRecordOnly> <inputParameters>
<object>Client_Case__c</object> <name>language</name>
<queriedFields>Id</queriedFields> <value>
<queriedFields>Docusign_Envelope_Language__c</queriedFields> <elementReference>Get_Records.Docusign_Envelope_Language__c</elementReference>
<storeOutputAutomatically>true</storeOutputAutomatically> </value>
</recordLookups> </inputParameters>
<nameSegment>DocusignCompositeEnvelopeBuilder</nameSegment>
<!-- ==================== STEP 2: Check Language ==================== --> <offset>0</offset>
<outputParameters>
<assignToReference>envelopeId</assignToReference>
<name>envelopeId</name>
</outputParameters>
<outputParameters>
<assignToReference>envelopeSuccess</assignToReference>
<name>success</name>
</outputParameters>
<outputParameters>
<assignToReference>envelopeErrorMessage</assignToReference>
<name>errorMessage</name>
</outputParameters>
</actionCalls>
<apiVersion>60.0</apiVersion>
<areMetricsLoggedToDataCloud>false</areMetricsLoggedToDataCloud>
<assignments>
<name>Add_Template_ID</name>
<label>Add Template ID</label>
<locationX>50</locationX>
<locationY>890</locationY>
<assignmentItems>
<assignToReference>compositeTemplateIds</assignToReference>
<operator>Add</operator>
<value>
<elementReference>Build_Template_ID_Collection.dfsle__DocuSignId__c</elementReference>
</value>
</assignmentItems>
<connector>
<targetReference>Build_Template_ID_Collection</targetReference>
</connector>
</assignments>
<decisions>
<name>Check_Envelope_Result</name>
<label>Check Envelope Result</label>
<locationX>50</locationX>
<locationY>1108</locationY>
<defaultConnector>
<targetReference>Error_Screen</targetReference>
</defaultConnector>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
<name>Envelope_Sent_Successfully</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>envelopeSuccess</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<booleanValue>true</booleanValue>
</rightValue>
</conditions>
<connector>
<targetReference>Success_Screen</targetReference>
</connector>
<label>Envelope Sent Successfully</label>
</rules>
</decisions>
<decisions>
<name>Check_Row_Selection</name>
<label>Check Row Selection</label>
<locationX>182</locationX>
<locationY>674</locationY>
<defaultConnector>
<targetReference>Row_not_selected</targetReference>
</defaultConnector>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
<name>Is_Row_Selected</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>data.firstSelectedRow.Id</leftValueReference>
<operator>IsNull</operator>
<rightValue>
<booleanValue>false</booleanValue>
</rightValue>
</conditions>
<connector>
<targetReference>Build_Template_ID_Collection</targetReference>
</connector>
<label>Is Row Selected?</label>
</rules>
</decisions>
<decisions> <decisions>
<name>Is_Language_Selected</name> <name>Is_Language_Selected</name>
<label>Is Language Selected?</label> <label>Is Language Selected?</label>
@ -116,64 +137,42 @@
<label>Language Selected?</label> <label>Language Selected?</label>
</rules> </rules>
</decisions> </decisions>
<environments>Default</environments>
<screens> <interviewLabel>Docusign Envelope Templates V3 {!$Flow.CurrentDateTime}</interviewLabel>
<name>Language_Not_Added_Screen</name> <label>Docusign Envelope Templates V3</label>
<label>Language Not Added Screen</label> <loops>
<locationX>578</locationX> <name>Build_Template_ID_Collection</name>
<locationY>350</locationY> <label>Build Template ID Collection</label>
<allowBack>false</allowBack> <locationX>50</locationX>
<allowFinish>true</allowFinish> <locationY>782</locationY>
<allowPause>false</allowPause> <collectionReference>data.selectedRows</collectionReference>
<fields> <iterationOrder>Asc</iterationOrder>
<name>LanguageNotSelected</name> <nextValueConnector>
<fieldText>&lt;p&gt;The &lt;strong&gt;DocuSign Envelope Language&lt;/strong&gt; is not populated on the record. Please add the language first and then proceed.&lt;/p&gt;</fieldText> <targetReference>Add_Template_ID</targetReference>
<fieldType>DisplayText</fieldType> </nextValueConnector>
<styleProperties> <noMoreValuesConnector>
<verticalAlignment> <targetReference>Send_Composite_Envelope</targetReference>
<stringValue>top</stringValue> </noMoreValuesConnector>
</verticalAlignment> </loops>
<width> <processMetadataValues>
<stringValue>12</stringValue> <name>BuilderType</name>
</width> <value>
</styleProperties> <stringValue>LightningFlowBuilder</stringValue>
</fields> </value>
<showFooter>true</showFooter> </processMetadataValues>
<showHeader>true</showHeader> <processMetadataValues>
</screens> <name>CanvasMode</name>
<value>
<screens> <stringValue>AUTO_LAYOUT_CANVAS</stringValue>
<name>Language_Warning_Screen</name> </value>
<label>Language Warning Screen</label> </processMetadataValues>
<locationX>182</locationX> <processMetadataValues>
<locationY>350</locationY> <name>OriginBuilderType</name>
<allowBack>false</allowBack> <value>
<allowFinish>true</allowFinish> <stringValue>LightningFlowBuilder</stringValue>
<allowPause>false</allowPause> </value>
<connector> </processMetadataValues>
<targetReference>DocuSign_Envelope_Templates</targetReference> <processType>Flow</processType>
</connector>
<fields>
<name>LangWarningText</name>
<fieldText>&lt;p&gt;The current selected language is &lt;strong&gt;{!Get_Records.Docusign_Envelope_Language__c}. &lt;/strong&gt;On the next screen you will be able to see form names of {!Get_Records.Docusign_Envelope_Language__c} language only. If you want to switch the language, please go back to record and select another language form &lt;strong&gt;DocuSign Envelope Language&lt;/strong&gt;.&lt;/p&gt;</fieldText>
<fieldType>DisplayText</fieldType>
<styleProperties>
<verticalAlignment>
<stringValue>top</stringValue>
</verticalAlignment>
<width>
<stringValue>12</stringValue>
</width>
</styleProperties>
</fields>
<nextOrFinishButtonLabel>Next</nextOrFinishButtonLabel>
<showFooter>true</showFooter>
<showHeader>true</showHeader>
</screens>
<!-- ==================== STEP 3: Query Envelope Templates ==================== -->
<!-- CHANGED: Now also queries dfsle__DocuSignId__c for composite envelope -->
<recordLookups> <recordLookups>
<name>DocuSign_Envelope_Templates</name> <name>DocuSign_Envelope_Templates</name>
<label>DocuSign Envelope Templates</label> <label>DocuSign Envelope Templates</label>
@ -200,9 +199,29 @@
<sortOrder>Asc</sortOrder> <sortOrder>Asc</sortOrder>
<storeOutputAutomatically>true</storeOutputAutomatically> <storeOutputAutomatically>true</storeOutputAutomatically>
</recordLookups> </recordLookups>
<recordLookups>
<!-- ==================== STEP 4: Data Table Screen ==================== --> <name>Get_Records</name>
<label>Get Records</label>
<locationX>380</locationX>
<locationY>134</locationY>
<assignNullValuesIfNoRecordsFound>false</assignNullValuesIfNoRecordsFound>
<connector>
<targetReference>Is_Language_Selected</targetReference>
</connector>
<filterLogic>and</filterLogic>
<filters>
<field>Id</field>
<operator>EqualTo</operator>
<value>
<elementReference>recordId</elementReference>
</value>
</filters>
<getFirstRecordOnly>true</getFirstRecordOnly>
<object>Client_Case__c</object>
<queriedFields>Id</queriedFields>
<queriedFields>Docusign_Envelope_Language__c</queriedFields>
<storeOutputAutomatically>true</storeOutputAutomatically>
</recordLookups>
<screens> <screens>
<name>Envelope_template_records</name> <name>Envelope_template_records</name>
<label>Envelope template records</label> <label>Envelope template records</label>
@ -269,200 +288,6 @@
<showFooter>true</showFooter> <showFooter>true</showFooter>
<showHeader>true</showHeader> <showHeader>true</showHeader>
</screens> </screens>
<!-- ==================== STEP 5: Check Row Selection ==================== -->
<decisions>
<name>Check_Row_Selection</name>
<label>Check Row Selection</label>
<locationX>182</locationX>
<locationY>674</locationY>
<defaultConnector>
<targetReference>Row_not_selected</targetReference>
</defaultConnector>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
<name>Is_Row_Selected</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>data.firstSelectedRow.Id</leftValueReference>
<operator>IsNull</operator>
<rightValue>
<booleanValue>false</booleanValue>
</rightValue>
</conditions>
<connector>
<targetReference>Build_Template_ID_Collection</targetReference>
</connector>
<label>Is Row Selected?</label>
</rules>
</decisions>
<screens>
<name>Row_not_selected</name>
<label>Row not selected</label>
<locationX>314</locationX>
<locationY>782</locationY>
<allowBack>true</allowBack>
<allowFinish>true</allowFinish>
<allowPause>false</allowPause>
<backButtonLabel>Back</backButtonLabel>
<fields>
<name>ErrorMessage</name>
<fieldText>&lt;p&gt;&lt;strong style=&quot;background-color: rgb(255, 255, 255); color: rgb(68, 68, 68);&quot;&gt;&lt;em&gt;You have not selected any of the forms. Please go back and select the form first and then proceed.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;</fieldText>
<fieldType>DisplayText</fieldType>
<styleProperties>
<verticalAlignment>
<stringValue>top</stringValue>
</verticalAlignment>
<width>
<stringValue>12</stringValue>
</width>
</styleProperties>
</fields>
<showFooter>true</showFooter>
<showHeader>false</showHeader>
</screens>
<!-- ==================== STEP 6: Build Template ID Collection (NEW) ==================== -->
<!-- Loop through selected rows and extract DocuSign template IDs -->
<loops>
<name>Build_Template_ID_Collection</name>
<label>Build Template ID Collection</label>
<locationX>50</locationX>
<locationY>782</locationY>
<collectionReference>data.selectedRows</collectionReference>
<iterationOrder>Asc</iterationOrder>
<nextValueConnector>
<targetReference>Add_Template_ID</targetReference>
</nextValueConnector>
<noMoreValuesConnector>
<targetReference>Send_Composite_Envelope</targetReference>
</noMoreValuesConnector>
</loops>
<!-- Assignment: Add current template's DocuSign ID to the collection -->
<assignments>
<name>Add_Template_ID</name>
<label>Add Template ID</label>
<locationX>50</locationX>
<locationY>890</locationY>
<assignmentItems>
<assignToReference>compositeTemplateIds</assignToReference>
<operator>Add</operator>
<value>
<elementReference>Build_Template_ID_Collection.dfsle__DocuSignId__c</elementReference>
</value>
</assignmentItems>
<connector>
<targetReference>Build_Template_ID_Collection</targetReference>
</connector>
</assignments>
<!-- ==================== STEP 7: Send Composite Envelope (NEW) ==================== -->
<!-- Single API call with all template IDs -->
<actionCalls>
<name>Send_Composite_Envelope</name>
<label>Send Composite Envelope</label>
<locationX>50</locationX>
<locationY>1000</locationY>
<actionName>DocusignCompositeEnvelopeBuilder</actionName>
<actionType>apex</actionType>
<connector>
<targetReference>Check_Envelope_Result</targetReference>
</connector>
<flowTransactionModel>Automatic</flowTransactionModel>
<inputParameters>
<name>templateIds</name>
<value>
<elementReference>compositeTemplateIds</elementReference>
</value>
</inputParameters>
<inputParameters>
<name>recordId</name>
<value>
<elementReference>recordId</elementReference>
</value>
</inputParameters>
<inputParameters>
<name>language</name>
<value>
<elementReference>Get_Records.Docusign_Envelope_Language__c</elementReference>
</value>
</inputParameters>
<nameSegment>DocusignCompositeEnvelopeBuilder</nameSegment>
<offset>0</offset>
<outputParameters>
<assignToReference>envelopeId</assignToReference>
<name>envelopeId</name>
</outputParameters>
<outputParameters>
<assignToReference>envelopeSuccess</assignToReference>
<name>success</name>
</outputParameters>
<outputParameters>
<assignToReference>envelopeErrorMessage</assignToReference>
<name>errorMessage</name>
</outputParameters>
</actionCalls>
<!-- ==================== STEP 8: Check Result (NEW) ==================== -->
<decisions>
<name>Check_Envelope_Result</name>
<label>Check Envelope Result</label>
<locationX>50</locationX>
<locationY>1108</locationY>
<defaultConnector>
<targetReference>Error_Screen</targetReference>
</defaultConnector>
<defaultConnectorLabel>Default Outcome</defaultConnectorLabel>
<rules>
<name>Envelope_Sent_Successfully</name>
<conditionLogic>and</conditionLogic>
<conditions>
<leftValueReference>envelopeSuccess</leftValueReference>
<operator>EqualTo</operator>
<rightValue>
<booleanValue>true</booleanValue>
</rightValue>
</conditions>
<connector>
<targetReference>Success_Screen</targetReference>
</connector>
<label>Envelope Sent Successfully</label>
</rules>
</decisions>
<!-- ==================== SCREENS ==================== -->
<screens>
<name>Success_Screen</name>
<label>Success Screen</label>
<locationX>50</locationX>
<locationY>1216</locationY>
<allowBack>false</allowBack>
<allowFinish>true</allowFinish>
<allowPause>false</allowPause>
<fields>
<name>SuccessMessage</name>
<fieldText>&lt;p&gt;&lt;span style=&quot;font-size: 16px; color: rgb(0, 128, 0);&quot;&gt;✅ Composite envelope sent successfully!&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Envelope ID:&lt;/strong&gt; {!envelopeId}&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Templates combined:&lt;/strong&gt; All selected templates were merged into a single envelope.&lt;/p&gt;</fieldText>
<fieldType>DisplayText</fieldType>
<styleProperties>
<verticalAlignment>
<stringValue>top</stringValue>
</verticalAlignment>
<width>
<stringValue>12</stringValue>
</width>
</styleProperties>
</fields>
<showFooter>true</showFooter>
<showHeader>false</showHeader>
</screens>
<screens> <screens>
<name>Error_Screen</name> <name>Error_Screen</name>
<label>Error Screen</label> <label>Error Screen</label>
@ -488,25 +313,148 @@
<showFooter>true</showFooter> <showFooter>true</showFooter>
<showHeader>false</showHeader> <showHeader>false</showHeader>
</screens> </screens>
<screens>
<!-- ==================== METADATA ==================== --> <name>Language_Not_Added_Screen</name>
<label>Language Not Added Screen</label>
<processMetadataValues> <locationX>578</locationX>
<name>BuilderType</name> <locationY>350</locationY>
<value> <allowBack>false</allowBack>
<stringValue>LightningFlowBuilder</stringValue> <allowFinish>true</allowFinish>
</value> <allowPause>false</allowPause>
</processMetadataValues> <fields>
<processMetadataValues> <name>LanguageNotSelected</name>
<name>CanvasMode</name> <fieldText>&lt;p&gt;The &lt;strong&gt;DocuSign Envelope Language&lt;/strong&gt; is not populated on the record. Please add the language first and then proceed.&lt;/p&gt;</fieldText>
<value> <fieldType>DisplayText</fieldType>
<stringValue>AUTO_LAYOUT_CANVAS</stringValue> <styleProperties>
</value> <verticalAlignment>
</processMetadataValues> <stringValue>top</stringValue>
<processMetadataValues> </verticalAlignment>
<name>OriginBuilderType</name> <width>
<value> <stringValue>12</stringValue>
<stringValue>LightningFlowBuilder</stringValue> </width>
</value> </styleProperties>
</processMetadataValues> </fields>
<showFooter>true</showFooter>
<showHeader>true</showHeader>
</screens>
<screens>
<name>Language_Warning_Screen</name>
<label>Language Warning Screen</label>
<locationX>182</locationX>
<locationY>350</locationY>
<allowBack>false</allowBack>
<allowFinish>true</allowFinish>
<allowPause>false</allowPause>
<connector>
<targetReference>DocuSign_Envelope_Templates</targetReference>
</connector>
<fields>
<name>LangWarningText</name>
<fieldText>&lt;p&gt;The current selected language is &lt;strong&gt;{!Get_Records.Docusign_Envelope_Language__c}. &lt;/strong&gt;On the next screen you will be able to see form names of {!Get_Records.Docusign_Envelope_Language__c} language only. If you want to switch the language, please go back to record and select another language form &lt;strong&gt;DocuSign Envelope Language&lt;/strong&gt;.&lt;/p&gt;</fieldText>
<fieldType>DisplayText</fieldType>
<styleProperties>
<verticalAlignment>
<stringValue>top</stringValue>
</verticalAlignment>
<width>
<stringValue>12</stringValue>
</width>
</styleProperties>
</fields>
<nextOrFinishButtonLabel>Next</nextOrFinishButtonLabel>
<showFooter>true</showFooter>
<showHeader>true</showHeader>
</screens>
<screens>
<name>Row_not_selected</name>
<label>Row not selected</label>
<locationX>314</locationX>
<locationY>782</locationY>
<allowBack>true</allowBack>
<allowFinish>true</allowFinish>
<allowPause>false</allowPause>
<backButtonLabel>Back</backButtonLabel>
<fields>
<name>ErrorMessage</name>
<fieldText>&lt;p&gt;&lt;strong style=&quot;background-color: rgb(255, 255, 255); color: rgb(68, 68, 68);&quot;&gt;&lt;em&gt;You have not selected any of the forms. Please go back and select the form first and then proceed.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;</fieldText>
<fieldType>DisplayText</fieldType>
<styleProperties>
<verticalAlignment>
<stringValue>top</stringValue>
</verticalAlignment>
<width>
<stringValue>12</stringValue>
</width>
</styleProperties>
</fields>
<showFooter>true</showFooter>
<showHeader>false</showHeader>
</screens>
<screens>
<name>Success_Screen</name>
<label>Success Screen</label>
<locationX>50</locationX>
<locationY>1216</locationY>
<allowBack>false</allowBack>
<allowFinish>true</allowFinish>
<allowPause>false</allowPause>
<fields>
<name>SuccessMessage</name>
<fieldText>&lt;p&gt;&lt;span style=&quot;font-size: 16px; color: rgb(0, 128, 0);&quot;&gt;✅ Composite envelope sent successfully!&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Envelope ID:&lt;/strong&gt; {!envelopeId}&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Templates combined:&lt;/strong&gt; All selected templates were merged into a single envelope.&lt;/p&gt;</fieldText>
<fieldType>DisplayText</fieldType>
<styleProperties>
<verticalAlignment>
<stringValue>top</stringValue>
</verticalAlignment>
<width>
<stringValue>12</stringValue>
</width>
</styleProperties>
</fields>
<showFooter>true</showFooter>
<showHeader>false</showHeader>
</screens>
<start>
<locationX>254</locationX>
<locationY>0</locationY>
<connector>
<targetReference>Get_Records</targetReference>
</connector>
</start>
<status>Draft</status>
<variables>
<name>compositeTemplateIds</name>
<dataType>String</dataType>
<isCollection>true</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<variables>
<name>envelopeErrorMessage</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<variables>
<name>envelopeId</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<variables>
<name>envelopeSuccess</name>
<dataType>Boolean</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>false</isOutput>
</variables>
<variables>
<name>recordId</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>
</Flow> </Flow>