Skip to content

Fire preretrieve hook even when metadata is deleted (or add another hook)  #900

@FabienTaillon

Description

@FabienTaillon

Is your feature request related to a problem? Please describe.
When a metadata is deleted from the scratch org, technically nothing is retrieved via a package.xml with sfdx force:source:pull, and the preretrieve hook isn't fired.

What are you trying to do
There are currently some issues with the pull command (mostly because of dependencies not being tracked on the org in SourceMember). For instance, when you delete a field that is referenced in a Permission Set, the field is deleted locally but the related Permission Set isn't pulled. I would like to be able to add metadata to retrieve in this hook, even if no metadata is supposed to be retrieved (but something is "pulled", like a deletion).

Describe the solution you'd like
See the preretrieve hook firing on pull even if there are just deletions, and thus no package to retrieve so far. Also, having an additional attribute in the result type (similar to what we get with force:source:status with the changed metadata and state) would be a plus.

Describe alternatives you've considered
I tried using the postretrieve hooks which works, but need to retrieve a second time, plus this break the source tracking (I guess there is a way to make this work).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIssue or pull request for a new feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions