hardis:project:clean:retrievefolders
Description
Command Behavior
Retrieves specific folders of Dashboards, Documents, Email Templates, and Reports from a Salesforce org into your DX project sources.
This command is designed to help developers and administrators synchronize their local Salesforce DX project with the latest versions of these folder-based metadata types. It's particularly useful for:
- Selective Retrieval: Instead of retrieving all dashboards or reports, it allows you to retrieve specific folders, which can be more efficient for targeted development or backup.
- Maintaining Folder Structure: Ensures that the folder structure of these metadata types is preserved in your local project.
Technical explanations
The command's technical implementation involves:
- Folder Iteration: It defines a list of folder-based metadata types (
dashboards,documents,email,reports). - File System Check: For each type, it checks if the corresponding folder exists in
force-app/main/default/. - Recursive Retrieval: It iterates through subfolders within these main folders. For each subfolder, it constructs and executes a
sf project retrieve startcommand. - Salesforce CLI Integration: It uses
sf project retrieve start -m <MetadataType>:<FolderName>to retrieve the content of individual folders. This ensures that only the specified folder and its contents are retrieved. - Error Handling: It includes basic error handling for the
execCommandcalls.
Agent Mode
Supports non-interactive execution with --agent:
sf hardis:project:clean:retrievefolders --agent
In agent mode, all interactive prompts are skipped and default values are used.
Screenshots
The report, dashboard, document and email template folders of the Helios sources retrieved again from the org
Parameters
| Name | Type | Description | Default | Required | Options |
|---|---|---|---|---|---|
| agent | boolean | Run in non-interactive mode for agents and automation | |||
| debug -d |
boolean | Activate debug mode (more logs) | |||
| flags-dir | option | Import flag values from a directory. | |||
| json | boolean | Format output as json. | |||
| skipauth | boolean | Skip authentication check when a default username is required | |||
| target-org -o |
option | Username or alias of the target org. Not required if the target-org configuration variable is already set. |
true | ||
| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration |
Examples
$ sf hardis:project:clean:retrievefolders
$ sf hardis:project:clean:retrievefolders --agent
