1

I am trying to retrieve Process builder flows from sandbox org using Ant migration tool and it is failing to retrieve flows with this message :

[sf:retrieve] package.xml - Entity of type 'Flow' named 'Account_Flow' cannot be found

My Package.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>    
    <members>Account_Flow</members>
    <name>Flow</name>
  </types>
<version>41.0</version>
</Package>

NOTE: I did not write this package.xml by hand but it was generated by Salesforce package builder.

Build.xml

<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">

    <property file="build.properties"/>
    <property environment="env"/>


    <property name="sf.username" value="${env.SF_USERNAME}"/>
    <property name="sf.password" value="${env.SF_PASSWORD}"/>
    <property name="sf.serverurl" value="${env.SF_URL}"/>
    <property name="sf.maxPoll" value="${env.SF_MAXPOLL}"/>

    <taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
        <classpath>
            <pathelement location="../ant-salesforce.jar" />          
        </classpath>
    </taskdef>  

    <target name="retrieveUnpackaged">
      <mkdir dir="retrieveUnpackaged"/>
      <!-- Retrieve the contents into another directory -->
      <sf:retrieve username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" retrieveTarget="retrieveUnpackaged" unpackaged="unpackaged/package.xml"/>
    </target>
</project>

Folder structure:

Laptop:~/workspace/DEV_Environment$ tree
.
├── ant-salesforce.jar
└── ANTFolder
    ├── build.properties
    ├── build.xml
    ├── retrieveUnpackaged
    └── unpackaged
        └── package.xml

Command output:

Laptop:~/workspace/DEV_Environment/ANTFolder$ ant retrieveUnpackaged 
Buildfile: /workspace/Dev_Environment/ANTFolder/build.xml

retrieveUnpackaged:
    [mkdir] Created dir: /workspace/Dev_Environment/ANTFolder/retrieveUnpackaged
[sf:retrieve] Request for a retrieve submitted successfully.
[sf:retrieve] Request ID for the current retrieve task: YYYYYYYYYYYYYYrUAG
[sf:retrieve] Waiting for server to finish processing the request...
[sf:retrieve] Request Status: Pending
[sf:retrieve] Request Status: InProgress
[sf:retrieve] Request Status: Succeeded
[sf:retrieve] Retrieve warnings (1):
[sf:retrieve] package.xml - Entity of type 'Flow' named 'Account_Flow' cannot be found
[sf:retrieve] Finished request YYYYYYYYYYYYYYrUAG successfully.

There is a known issue for the same error but it says this error will happen only if we use the sf:bulkRetrieve and workaround suggested is to use sf:retrieve. I am using sf:retrieve and still getting the error.

I tried with Ant jar 42.0 and still same output.

Anyone ran into same error?

  • 2
    I guess, version is also required while fetching particular process builder - salesforce.stackexchange.com/a/211658/25920 – Ysr Shk Mar 28 '18 at 16:35
  • 2
    Just confirmed that myself--you need to include the version you want to retrieve. – sfdcfox Mar 28 '18 at 16:38
  • 2
    I just ran with wildcard character as <Flow>*</Flow> and it worked. Thanks. – javanoob Mar 28 '18 at 16:40
1

Originally, the old method of retrieving Process Builder flows required a -version_number at the end of the name like so: process_builder_flow-1, where -1 is the version number, .

This is no longer necessary as of API version 44. So the code from the question should have no problem during the retrieve now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.