I want to de-activate a process builder on a destination sandbox. I have set the status as Obsolete on the .flow file and deploy via Jenkins. But it didn't get deactivated. API Version is 52. Any idea? Will that going to be a manual step? I added the flowdefinition and made the version as 0 too
So you can deactivate a Process Builder by only deploying the
FlowDefinition and setting
activeVersionNumber to 0.
?xml version="1.0" encoding="UTF-8"?> <FlowDefinition xmlns="http://soap.sforce.com/2006/04/metadata"> <activeVersionNumber>0</activeVersionNumber> </FlowDefinition>
But, I'd recommend not using FlowDefinition as suggested in the docs
In API version 44.0, we recommend upgrading your flows to flow metadata file names without version numbers and discontinue using the FlowDefinition object to activate or deactivate a flow. Then use the Flow object to activate or deactivate a flow
The issue will be that this leaves you with a manual process for your given scenario. Hopefully, it would be a small use case where you deactivate an active flow (and that's the only action taken). The more common use case, deploying a new active version, is supported with the
Flow metadata assuming you turn on Deploy processes and flows as active within
Process Automation Settings
You may think doing this manually is too painful but, for source control purposes,
FlowDefinition can be confusing as it refers to version numbers that are no longer utilized since API 44 and could lead to incorrect changes as there's no guarantee the # of versions in one org matches with another depending on your pipeline/CI.
I would recommend upvoting the idea to Activate/Deactivate flows via Metadata API that is still open. Even though the documentation seems confusing as it seems to hint the
Flow should work, it's easy to test that you cannot deactivate a flow/PB and can only deploy new versions (as active) that can deactivate a previous version. Deploying draft Flow metadata to an org that has the given metadata activated will simply create a new version of that PB that is inactive (and leave the active version as is).