Site icon UnofficialSF

Deploying Flows From Summer Sandboxes to Spring Production Orgs

Loop elements created in Summer ’20 orgs handle the loop iteration automatically and do not require or allow creation of a manual Loop Variable. In metadata, they look like this:

 <loops>
        <name>testLoopElement1</name>
        <label>testLoopElement1</label>
        <locationX>177</locationX>
        <locationY>235</locationY>
        <collectionReference>testCollectionVar1</collectionReference>
        <iterationOrder>Asc</iterationOrder>
    </loops>

Loop elements in Spring orgs require a manual Loop Variable and refer to it via an element called <assignNextValueToReference>:

 <loops>
        <name>loopElement1</name>
        <label>loopElement1</label>
        <locationX>210</locationX>
        <locationY>167</locationY>
        <assignNextValueToReference>curAccountIterator</assignNextValueToReference>
        <collectionReference>curAccountCollection</collectionReference>
        <iterationOrder>Asc</iterationOrder>
    </loops>

The value of that element should point at a manual variable of the appropriate type. In this example, because the collection reference is a collection of Accounts, the Loop Variable needs to be a single Account variable:

<variables>
        <name>curAccountCollection</name>
        <dataType>SObject</dataType>
        <isCollection>true</isCollection>
        <isInput>false</isInput>
        <isOutput>false</isOutput>
        <objectType>Account</objectType>
    </variables>
    <variables>
        <name>curAccountIterator</name>
        <dataType>SObject</dataType>
        <isCollection>false</isCollection>
        <isInput>false</isInput>
        <isOutput>false</isOutput>
        <objectType>Account</objectType>
    </variables>

It’s possible to take a flow created on a Summer ’20 sandbox and modify it for deployment to a Spring ’20 production org. This involves the following steps:

  1. On the Summer org, use the Transfer Metadata screen component to download the flow you’ve created.
  2. Copy the resulting XML into a text editor, and modify it as follows:
    1. for each Loop element do the following:
      1. remove all references from other downstream elements to that Loop element. You’re about to change the Loop element and the references will break
      2. make sure you have a manual variable to represent the loop variable for that Loop.
      3. paste in the ‘assignNextValueToReference’ element, giving it the name of the manual variable you want to use for your Loop iterator
<assignNextValueToReference>curAccountIterator</assignNextValueToReference>
  1. Once you’re done with the above steps, you should have a Flow xml file that will deploy into a Spring ’20 org
  2. Use Transfer Metadata in another flow, this time on the production org. Set it to transferMode=deploy and pass it the modified Flow XML (the easiest way is usually to paste the text into a Text Template)

Exit mobile version
Skip to toolbar