-
-
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
feat: warn when a flow is deleted #894
Conversation
Please help reviewing here @amtrack :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #894 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 39 40 +1
Lines 1066 1074 +8
Branches 115 115
=========================================
+ Hits 1066 1074 +8 ☔ View full report in Codecov by Sentry. |
README.md
Outdated
|
||
We know 2 ways to delete flow (documented [here](https://github.com/scolladon/sfdx-git-delta/issues/588#issuecomment-1534318729)) | ||
- with `FlowDefinition` metadata, but is obsolete since v44 (and yet still working) | ||
- with flow status and purge of deactivated versions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scolladon I've just tested deploying the Flow with Status=Draft
and Status=Obsolete
and it didn't disable the Flow in my org.
This is also described here: #588 (comment)
In my opinion the second way would be be actually an addition to the first way:
What I have tested is, that you can disable the Flow using the FlowDefinition activeVersionNumber=0 and delete inactive Flow Versions in a single deployment (here v1 and v2) using a destructiveChanges.xml
like:
Set_Account_Description.flowDefinition-meta.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<FlowDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
<activeVersionNumber>0</activeVersionNumber>
</FlowDefinition>
package.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Set_Account_Description</members>
<name>FlowDefinition</name>
</types>
<version>61.0</version>
</Package>
destructiveChanges.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Set_Account_Description-1</members>
<members>Set_Account_Description-2</members>
<name>Flow</name>
</types>
<version>61.0</version>
</Package>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great combo, it could be the way to delete a flow with one go (until the v44 is decomissionated and FlowDefinition metadata is not available anymore).
The issue I see is it requires to know which flow versions to list in the destructiveChanges.xml... Which can be a complicated things to determine for SGD because it could not be the same in different environments and the plugin is not connected to any environment.
So I think it should not be handled by SGD.
It could be automatized by another plugin dedicated to deleting flow.
I'll update the documentation in the PR with your solution, thx
README.md
Outdated
We suggest to deal with flow deletion in one go by following those steps (it requires the `FlowDefinition` metadata which is not avalable in API `v44+`) | ||
1. Set the `FlowDefinition` `activeVersionNumber` to `0` | ||
2. List the `FlowDefinition` in the `package.xml` | ||
3. List all the existing version of the `Flow` in the `destructiveChanges.xml` (can be fetch via SOQL using this query : `SELECT FlowDefinitionView.ApiName, VersionNumber, Status FROM FlowVersionView WHERE FlowDefinitionView.ApiName='<FLOW_API_NAME>'`) | ||
4. Deploy this `FlowDefinition` with a `package.xml` and post delete all the `Flow` versions with a post `destructiveChangesPost.xml` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: do you think you could deal with this automation inside sfdx-hardis
I think it could be wrap behind a command like sf hardis org delete flow -n <FLOW_API_NAME>
, what do you think @nvuillam ?
Co-authored-by: Matthias Rolke <mr.amtrack@gmail.com>
d4368f8
to
4e9fafc
Compare
4e9fafc
to
fc5cfe0
Compare
Hi @amtrack ! We have updated the warning message and the readme, what do you think now ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@scolladon Thanks! Looks good to me! I've only suggested to correct destructiveChanges.xml
to destructiveChangesPost.xml
.
Co-authored-by: Matthias Rolke <mr.amtrack@gmail.com>
Co-authored-by: Matthias Rolke <mr.amtrack@gmail.com>
Code Climate has analyzed commit 39d040f and detected 0 issues on this pull request. View more on Code Climate. |
Shipped in release $ sfdx plugins:install sfdx-git-delta@latest-rc
$ sfdx plugins:install sfdx-git-delta@v5.41.0 Happy incremental deployment! |
Explain your changes
Add a warning in the output of SGD when the plugin detect a deletion of a flow
Does this close any currently open issues?
closes #893
Any particular element that can be tested locally
Any other comments