-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create FlowDefinitions for deleted Flows #588
Comments
I'm unclear what you mean, the |
How would sgd determine that a flow was deleted? If a flow is deleted, then sgd would create these flow definitions, and add the deleted flows back? This would require sgd to add a new commit. Or it could be done with a pre commit, or even pre push, ocliff hook to avoid an extra commit.
I would control the hook automation with an environment variable. |
Apologies if I haven't been clear. SGD already detects that a IMO Adding a Another (though maybe less relevant) argument against adding |
Hi @YodaDaCoda ! Thanks for raising this issue and thanks for contributing in making this project better! That being said, we all know it is kind of tricky to deal with
Some facts so far:
If I understand properly the need here:
The solution proposed in this enhancement request:When <?xml version ="1.0" encoding="UTF-8"?>
<FlowDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
<activeVersionNumber>0</activeVersionNumber>
</FlowDefinition> I see multiple risks here:
And, I'm not (yet) convinced it is something Alternative approachI'm not sure if it would be suitable for your situation @YodaDaCoda but let me try something:
I'm not very happy with this alternative workflow, it is me thinking out loud, but I thought it could be a start to think about it and maybe it could lead to new ideas. |
I believe the alternative approach can be reduced to a single commit if:
Then the rest is orchestrated in the CICD pipeline. Steps:
23echsd deletes Flow X because ...
{
...
"deleted_metadata": {
"flow": [ //metadata type keys follow the official metadata api specs
{
"path" : "./metadata/path", //we will need this information on step 4.1
...
}
],
...
},
...
} The list of delete metadata is used on steps 4.1 and 6.1 (pre|post deployment steps) to avoid wasting time reading git branch history again
wouldn't this work? |
@AllanOricil I think it would work, yes (though I have not tested it) and with this we can just use the flow deletion in the repo with one commit 🎩 Step 3 could be done without sgd, using $ git diff --diff-filter=D --name-only <from> <to> | grep "\.flow-meta.xml$" So to recap:
Alternatively for step 5 and 6 As this process forces the usage of deployment using delta sources instead of just using delta package.xml against sources from the repo I would prefer to keep it outside Interesting to see that Copado and Gearset deal with that using manual action. I feel we are close to find a "nearly generic" way to deal with Flow deletion here. |
@scolladon Why not include the metadata that was deleted in sgd`s output? |
EVERYTHING is scriptable :) Thanks for the ping @scolladon, I quickly read in 3mn , let's discuss it further this evening , but I think there is something to be done Meanwhile.... when you need to delete a flow (that should not happen so often) , just use https://sfdx-hardis.cloudity.com/hardis/org/purge/flow/ and then delete it manually before deployment ^^ @AllanOricil sfdx-git-delta generates a destructiveChanges.xml , it's easy to parse it to play with it, that's what we do to automatically update package.xml in sfdx-hardis :) To verify that, you can play with sfdx-git-delta by manually selecting commits in VsCode SFDX Hardis UI, the command is available in "Nerdy Stuff" menu :) |
@AllanOricil I would prefer not include the metadata that was deleted in sgd's output because:
The sha ref is written in |
SGD Rules! 😉 After a bit of testing, I've determined a couple things that lead me to conclude that
My thoughts regarding development practice is to:
Details of testingonce a version of a flow has been active, that version cannot be changed, only made inactive. test 1: test 2: test 3: test 4: test 5: test 6: test 7: conclusion: when there are multiple versions of a flow in salesforce, the git metadata cannot be trusted as a source of truth without additional effort |
Hi @YodaDaCoda, thank you very much for those details, very helpful. I guess your conclusion also explain why Gearset and Copado choose to deal with those Flow version the way they do. Thanks for you thought, very helpful, that's a big takeaway for anyone. Before closing this enhancement request, what would be your workflow in the end ? |
@YodaDaCoda @scolladon The build job that runs inside salesforce changes depending on the API version used to deploy things, right? Did you run the same set of tests using different API versions? Maybe running the same tests from |
Thanks for thinking about it @AllanOricil |
Are you 100% sure ? |
@AllanOricil I agree testing with API versions @nvuillam 100%. I double-checked. If the metadata of the Flow you're deploying exactly matches the flow that's already in Salesforce (with the exception of the This means if someone activates an older version of a flow directly in the org, then the latest version is re-deployed (e.g. as part of a CI/CD job), then the old version will remain active. ☠️ @scolladon my end workflow will be to:
|
Ok thank @YodaDaCoda So you'll go for the Thanks for the discussion here guys, I hope |
@scolladon I just tested deactivating a I've just created a prototype: #893
|
Is your proposal related to a problem?
I'd like to be able to leverage SGD to delete flows, but due to a Salesforce limitation ("Working as Expected"), I doubt that's ever going to be the case.
Describe a solution you propose
While
Flow
s can't easily be deleted indestructiveChanges.xml
, we can deactivate flows by deploying aFlowDefinition
withactiveVersionNumber
set to0
. We can later purge inactive flows.e.g.
My_Flow.flow-meta.xml
I propose adding functionality to SGD that would allow for creation of these
FlowDefinition
s. Given how this would work, it'd likely have to be behind an additional flag (e.g.--transform-destructive-flows
), and would only work with--generate-delta
(the README would have to make this very clear, and use of the new flag without--generate-delta
should probably throw an error.Describe alternatives you've considered
I've considered writing a script to do this, which wouldn't be complicated, but I think this fits in within the goals of SGD.
Additional context
Earlier related issue: #366
Salesforce Known Issue: https://issues.salesforce.com/issue/a028c00000gAwixAAC/deletion-of-flow-metadata-through-destructive-changes-not-supported
The text was updated successfully, but these errors were encountered: