Strange Behaviour. 1. When i perform a list operation on Flow, I get the following response.

         "createdById": "00520000003eLmNAAU",
         "createdByName": "Gunish Rai Chawla",
         "createdDate": "2014-08-11T16:42:47.000Z",
         "fileName": "flows/ProjectProgressFlow.flow",
         "fullName": "ProjectProgressFlow",
         "id": "301200000000ETlAAM",
         "lastModifiedById": "00520000003eLmNAAU",
         "lastModifiedByName": "Gunish Rai Chawla",
         "lastModifiedDate": "2014-08-11T18:43:04.000Z",
         "manageableState": "unmanaged",
         "type": "Flow"

So Far so Good,

But when I fire a retrieve request using the data from the listResponse.

    "name": "Flow",
    "members": [

I get a blank ?

Anyone else seen similar behaviour ?

  • Which platform you are using to retrieve? – Ashwani Sep 23 '14 at 16:57
  • this is a grunt / node.js script but it could be any platform as this request works fine for everything else apart from FLOW. My suspicion is so far around various version of flow. – Gunish Sep 23 '14 at 16:58
  • Try with version 29. Also it seems that both requests are different. – Ashwani Sep 23 '14 at 17:00
  • Tried with version 29, save behaviour. Strangely, the wildcards work. But giving a specific file name does not. – Gunish Sep 23 '14 at 17:20
  • Perhaps you are passing a different name than expected. Try using both filename and then fullname. In some cases fullname works. – Ashwani Sep 23 '14 at 17:27

When retrieving a flow from Salesforce, it seems that you need to specify the version of the flow as well. For some reason, the List Metadata API doesn't show the version number for the active version of the flow. It does show version numbers.

Listing Flows

For example, if I have a Flow called My_Custom_Flow, and I make 3 versions, and don't activate any of them, List Metadata will tell me I have the following:


If I then go ahead and activate version 3 of the flow, List Metadata will now say:


Deploying and Retrieving Flows

However, the actual API name of version 3 is still My_Custom_Flow-3, so when you go to retrieve it, you will need to call it by that name in your package.xml

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

The same applies for the metadata Deploy API; you should deploy the flow using the full API name (including version number), with the additional caveat that you can only deploy the flow version when that version has not been activated in the org before. So if I wanted to deploy a new copy of My_Custom_Flow to this org (where version 3 is activated), I would need to call the flow My_Custom_Flow-4.flow so that it does not conflict with the currently active version.

Getting the Version Number for a Flow

Unfortunately, all this means that it's pretty hard to do any useful automation around flows, because Salesforce's internal versioning strategy makes them a little hard to work with. If you need a scriptable way to get the currently active or latest version of a flow from your org, the Tooling API may help a little:

FROM FlowDefinition
WHERE DeveloperName = 'My_Custom_Flow'

This Tooling API's "query" service can give you both the currently active and the latest version number of the flow in your org.

   "size": 1,
   "totalSize": 1,
   "done": true,
   "queryLocator": null,
   "entityTypeName": "FlowDefinition",
   "records": [
         "attributes": {
            "type": "FlowDefinition",
            "url": "/services/data/v35.0/tooling/sobjects/FlowDefinition/..."
         "Id": "...",
         "ActiveVersion": {
            "attributes": {
               "type": "Flow",
               "url": "/services/data/v35.0/tooling/sobjects/Flow/..."
            "VersionNumber": 3
         "LatestVersion": {
            "attributes": {
               "type": "Flow",
               "url": "/services/data/v35.0/tooling/sobjects/Flow/..."
            "VersionNumber": 3

If you need to retrieve the currently active version of the flow, you can just use the flow's API name in combination with the ActiveVersion returned by this.

If you need to do something to automatically deploy new versions of the flow to your org, you can just take the LatestVersion number and add 1 to get an unused version number for the new flow.

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.