Okay, I did look into this a bit today. There seems to be a bug in the Salesforce metadata API when working with Flow metadata.
The issue is that Salesforce's listMetadata() API returns an incorrect entry for the active version of the FlowDefinition. The returned name and filename of the active version don't include the "-version" part. For example, I have a flow with three versions and the second one is active. The listMetadata() API returns them as "MyFlow-1", "MyFlow", and "MyFlow-3". If I change the active version to 3, I get back "MyFlow-1", "MyFlow-2", and "MyFlow". However, when you actually retrieve the metadata using a wildcard, you get back "MyFlow-1.flow", "MyFlow-2.flow", and "MyFlow-3.flow".
I've updated Illuminated Cloud to be able to work around this issue. Basically when your metadata subscription includes Flows, after I use listMetadata() to enumerate metadata of that type, I also run a SOQL query against the Flow SObject. I then correct the listMetadata() response so that your metadata subscription is correct. As a result, the package.xml that I create for metadata retrieval is also correct without having to resort to wildcards that might include things you don't want.
The fix will be in the next build. After updating the plugin, on your next retrieve do the follow to correct the metadata subscription:
- In the retrieval dialog, if you're using an explicit selection vs. Package.xml or All/Package:
- Click the pencil icon beside Contents to open the metadata subscription editor.
- Click the Refresh button beside Selected.
- Scroll down to the node for Flow and ensure that the things you want are selected.
- Click OK to return to the retrieval dialog.
- Now in the retrieval dialog, click the Refresh button on the toolbar.
- Scroll down to the node for flows and make sure the things you want are selected.
- Click OK to retrieve the metadata.
Hopefully that will give you back exactly what you're expecting with fine-grained control over your metadata subscription.
I'll try to get the new version uploaded tomorrow. I'll post another comment here once I've done so. Please let me know your findings after updating.
Regards,
Scott