- Why cleaning sources ?
- Destructive Changes
- List Views Mine
- Minimize Profiles
- Named metadatas
Why cleaning sources ?
Salesforce CI/CD Pipelines does not natively work without many manual operations to update the XML... so the deployments passes !
sfdx-hardis provides a set of commands to automate those boring XML updates that can be called every time a user prepares a merge request using command sfdx hardis:work:save
Here is the list of available automated cleanings, that can also be called manually using command
Example of cleaning config in a .sfdx-hardis.yml config file:
autoCleanTypes: - destructivechanges - datadotcom - minimizeProfiles - listViewsMine
Removes hardcoded user ids from Dashboards
Any file corresponding to an element existing in manifest/destructiveChanges.xml is deleted.
List Views Mine
List views with scope Mine can not be deployed.
As a workaround, scope is set back to Everything in XML, but the list view reference is kept in a property listViewsToSetToMine in .sfdx-hardis.yml, and after deployment, manual clicks are simulated to set back their scope to Mine !
It is a bad practice to define on Profiles elements that can be defined on Permission Sets.
Salesforce will deprecate such capability in Spring 26.
Don't wait for that, and use minimizeProfiles cleaning to automatically remove from Profiles any permission that exists on a Permission Set !
The following XML tags are removed automatically:
- userPermissions (except on Admin Profile)
You can override this list by defining a property minimizeProfilesNodesToRemove in your .sfdx-hardis.yml config file.
System.debug are useless, as explained in this article
Comments automatically all System.debug in the code to enhance performances.
Cleaning can remove files related to named elements.
Removes all Case Entitlement related fields, like Case.EntitlementId and Case.MilestoneStatus
Removes all Case Data.com related fields, like Account.DandbCompanyId and Account.Jigsaw
Removes all Local fields, like Account.NameLocal and Lead.CompanyLocal
Removes all Local fields, like ProductRequest.ShipToAddress and ProductRequest.ShipmentType