12

I'm using Salesforce Migration Tool (Ant) to deploy flows and processes. If memory serves, so long as the flow in the destination org was not activate (or deactivated) I could overwrite it. If you didn't disable the flow first, I'd get this error:

Error: The version of the flow you're updating is active and can't be overwritten

Now I am getting an error that tells me that the flow "was" active and cannot be overwritten, even after disabling the flow in the target org:

Error: The version of the flow you're updating was active and can't be overwritten

Perhaps this was the way it has always been and I'm just taking crazy pills. Either way, the only way I see around this is to create a new version all flows I want to deploy each time I want to deploy them. Or, never make the deployed flows activate in the target org, which will make testing them quite difficult.

Any suggestions on ways to numb this pain?

2 Answers 2

11

Once activated, a flow version can never be modified. In fact, about the only reasonable approach is to delete all paused interviews, deactivate the current flow version, delete all references to the flow, delete the flow entirely, then deploy the flow and all its references back in place.

This restriction exists because if a flow was active, it could have paused interviews or interviews already in progress, and so changing the flow's properties could invalidate those interviews. This is obviously an undesirable state since users would lose data, but it'd be a lot handier if Salesforce would simply check to see if there were any paused or active interviews and allow deletion or modification of a version if it's reasonably safe to do so.

2
  • 1
    Deleting all references in the target org to all flows in question solved the problem. This inconvenience might also be circumvented if the Salesforce Migration Tool didn't try to deploy a flow that hasn't changed. Sep 10, 2015 at 17:58
  • @sfdcfox if anyone try to deactivate the flow with the help of Metadata API or Tooling API. whether that is possible ?
    – Avijit Das
    Mar 10, 2022 at 6:36
0

Once tactic that worked for me is this and you can do this while the flows are active:

  1. Do a source retrieve from the org in which you would like to deploy the flows and only retrieve the flow metadata with a source retrieve command

sfdx force:source:retrieve --targetusername SomeSandbox -m Flow

  1. Then you should be able to complete your deployment using source deploy successfully.

One thing to mention is that if you don't change any of the flow files locally then they will stay on the current version in your org when deploying. However, if you make a change to a flow locally and then try to deploy that flow to your org then the most current version will be deactivated and a new version will be created.

I hope this helps!

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.