hardis:project:fix:profiletabs
Description
Command Behavior
Interactively updates tab visibility settings in Salesforce profiles, addressing a common issue where tab visibilities are not correctly retrieved by sf project retrieve start.
This command provides a user-friendly interface to manage tab settings within your profile XML files, ensuring that your local project accurately reflects the intended tab configurations in your Salesforce org.
Key functionalities:
- Interactive Tab Selection: Displays a multi-select menu of all available tabs in your org, allowing you to choose which tabs to update.
- Visibility Control: Lets you set the visibility for the selected tabs to either
DefaultOn(Visible) orHidden. - Profile Selection: Presents a multi-select menu of all .profile-meta.xml files in your project, allowing you to apply the tab visibility changes to specific profiles.
- XML Updates: Modifies the
section of the selected profile XML files to reflect the chosen tab settings. If a tab visibility setting already exists for a selected tab, it will be updated; otherwise, a new one will be added. - Sorted Output: The
in the updated profile XML files are sorted alphabetically for consistency and readability.
Technical explanations
The command's technical implementation involves:
- SOQL Queries (Tooling API): It queries the
TabDefinitionobject usingsoqlQueryToolingto retrieve a list of all available tabs in the target org. - File Discovery: Uses
globto find all .profile-meta.xml files within the specified project path. - Interactive Prompts: Leverages the
promptslibrary to create interactive menus for selecting tabs, visibility settings, and profiles. - XML Parsing and Manipulation: Uses
parseXmlFileto read the content of profile XML files andwriteXmlFileto write the modified content back. It manipulates thetabVisibilitiesarray within the parsed XML to add or update tab settings. - Array Sorting: Employs the
sort-arraylibrary to sort thetabVisibilitiesalphabetically by tab name. - Logging: Provides feedback to the user about which profiles have been updated and a summary of the changes.
Agent Mode
Supports non-interactive execution with --agent:
sf hardis:project:fix:profiletabs --agent
In agent mode:
- All available tabs are processed with
DefaultOnvisibility - All profiles found in the project are updated
- All interactive prompts are skipped
Screenshots
Pick the tabs to show or hide
Pick the profiles to update
The Installations and Panel Batches tabs set visible in the Helios Crew profile of the sources
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. | |||
| path -p |
option | Root folder | /home/runner/work/sfdx-hardis/sfdx-hardis | ||
| 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:fix:profiletabs
$ sf hardis:project:fix:profiletabs --agent


