SharinPix salesforce cli plugin
npm install @sharinpix/sharinpix-sf-cli  
The SharinPix Salesforce CLI plugin provides tools to interact with SharinPix organization configuration, form templates, and permissions in your Salesforce orgs. This plugin allows you to pull and push configs, form templates, and permissions from/to your Salesforce org, saving them as local JSON files for version control and deployment management.
sf pluginsSalesforce CLI plugins are based on the oclif plugin framework>). Read the plugin developer guide to learn about Salesforce CLI plugin development.
This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the node developer packages used by Salesforce.
Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the posttest script and it is required to keep these tests active in your plugin if you plan to have it bundled.
- @salesforce/core
- @salesforce/kit
- @salesforce/sf-plugins-core
- @salesforce/ts-types
- @salesforce/ts-sinon
- @salesforce/dev-config
- @salesforce/dev-scripts
For cross clouds commands, e.g. sf env list, we utilize oclif hooks to get the relevant information from installed plugins.
This plugin includes sample hooks in the src/hooks directory. You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
This plugin is bundled with the Salesforce CLI. For more information on the CLI, read the getting started guide.
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
``bash
sf org login web
sf plugins install @sharinpix/sharinpix-sf-cli
Issues
Please report any issues at https://github.com/sharinpix/sharinpix-sf-cli/issues
Contributing
1. Please read our Code of Conduct
2. Create a new issue before starting your project so that we can keep track of
what you are trying to add/fix. That way, we can also offer suggestions or
let you know if there is already an effort in progress.
3. Fork this repository.
4. Build the plugin locally
5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
6. Edit the code in your fork.
7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
8. Sign CLA (see CLA below).
9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
$3
External contributors will be required to sign a Contributor's License
Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
$3
To build the plugin locally, make sure to have npm installed and run the following commands:
`bash
Clone the repository
git clone git@github.com:sharinpix/sharinpix-sf-cliInstall the dependencies and compile
yarn && yarn run build
`To use your plugin, run using the local
./bin/dev or ./bin/dev.cmd file.`bash
Run using local run file.
./bin/dev sharinpix pull --target-org myorg@example.com
./bin/dev sharinpix config pull --target-org myorg@example.com
./bin/dev sharinpix form pull --target-org myorg@example.com
./bin/dev sharinpix permission pull --target-org myorg@example.com
`There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
`bash
Link your plugin to the sf cli
sf plugins link .
To verify
sf plugins
`Key Features
$3
Both
form push and permission push commands support a --delete/-d flag that provides automatic cleanup of orphaned records:- Orphaned Records: Records that exist in your Salesforce org but no longer have corresponding local JSON files
- Safety: Deletion only occurs when the flag is explicitly provided
- Reporting: The command reports how many records were deleted, failed, uploaded, and skipped
- Error Handling: If a deletion fails, it's logged as a warning and counted in the failed total
⚠️ Important: Use the
--delete flag with caution as deletions cannot be undone. Always ensure you have backups of your data before using this feature.Example Workflow:
1. Pull existing records:
sf sharinpix form pull
2. Remove unwanted local JSON files
3. Push with cleanup: sf sharinpix form push --deleteCommands
sf sharinpix config pull
* sf sharinpix config push
* sf sharinpix form csv2json
* sf sharinpix form json2csv
* sf sharinpix form pull
* sf sharinpix form push
* sf sharinpix permission pull
* sf sharinpix permission push
* sf sharinpix pull
* sf sharinpix push
* sf sharinpix settingssf sharinpix config pullPull organization config from SharinPix API.
`
USAGE
$ sf sharinpix config pull -o [--json] [--flags-dir ]FLAGS
-o, --org= (required) The Salesforce org to authenticate with.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Pull organization config from SharinPix API.
Downloads the organization configuration from the SharinPix API and saves it to a local JSON file. This command
connects to your Salesforce org to obtain an authentication token, then fetches the config from the SharinPix API
endpoint.
EXAMPLES
Pull organization config using the default org:
$ sf sharinpix config pull
Pull organization config from a specific org:
$ sf sharinpix config pull --target-org myorg@example.com
FLAG DESCRIPTIONS
-o, --org= The Salesforce org to authenticate with.
The Salesforce org used to obtain the authentication token for accessing the SharinPix API.
`sf sharinpix config pushPush organization config to SharinPix API.
`
USAGE
$ sf sharinpix config push -o [--json] [--flags-dir ]FLAGS
-o, --org= (required) The Salesforce org to authenticate with.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Push organization config to SharinPix API.
Uploads the organization configuration from a local JSON file to the SharinPix API. This command connects to your
Salesforce org to obtain an authentication token, then pushes the config to the SharinPix API endpoint.
EXAMPLES
Push organization config using the default org:
$ sf sharinpix config push
Push organization config to a specific org:
$ sf sharinpix config push --target-org myorg@example.com
FLAG DESCRIPTIONS
-o, --org= The Salesforce org to authenticate with.
The Salesforce org used to obtain the authentication token for accessing the SharinPix API.
`sf sharinpix form csv2jsonGenerate JSON files from SharinPix form CSV definitions.
`
USAGE
$ sf sharinpix form csv2json [--json] [--flags-dir ]GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Generate JSON files from SharinPix form CSV definitions.
Scans the local
sharinpix/forms directory for SharinPix form CSV definition files and generates corresponding JSON
files. Each CSV file is expected to have a header row of element keys and one row per element, as produced by the
json2csv command.EXAMPLES
Generate JSON files for all local SharinPix form CSV definitions:
$ sf sharinpix form csv2json
`sf sharinpix form json2csvGenerate CSV files from SharinPix form JSON definitions.
`
USAGE
$ sf sharinpix form json2csv [--json] [--flags-dir ]GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Generate CSV files from SharinPix form JSON definitions.
Scans the local
sharinpix/forms directory for SharinPix form JSON definition files and generates corresponding CSV
files. The CSV files contain a header row built from all element keys and one row per element. Nested values are
stringified.EXAMPLES
Generate CSV files for all local SharinPix form JSON definitions:
$ sf sharinpix form json2csv
`sf sharinpix form pullPull SharinPix form templates from Salesforce org.
`
USAGE
$ sf sharinpix form pull -o [--json] [--flags-dir ] [-c]FLAGS
-c, --csv Also generate CSV files from the downloaded JSON form definitions.
-o, --org= (required) The Salesforce org to pull form templates from.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Pull SharinPix form templates from Salesforce org.
Retrieves all SharinPix form templates from the connected Salesforce org and saves them as JSON files in the local
sharinpix/forms directory. This command fetches the form template metadata and downloads the actual form definition
files.
EXAMPLES
Pull all form templates from the default org:
$ sf sharinpix form pull
Pull form templates from a specific org:
$ sf sharinpix form pull --target-org myorg@example.com
Pull form templates and also generate CSV files:
$ sf sharinpix form pull --csv
FLAG DESCRIPTIONS
-c, --csv Also generate CSV files from the downloaded JSON form definitions.
When enabled, after downloading all form templates as JSON into
sharinpix/forms, the command runs the JSON-to-CSV
conversion (same as sharinpix:form:json2csv). -o, --org= The Salesforce org to pull form templates from.
The target Salesforce org containing the SharinPix form templates to be pulled.
`sf sharinpix form pushPush SharinPix form templates to Salesforce org.
`
USAGE
$ sf sharinpix form push -o [--json] [--flags-dir ] [-d] [-c]FLAGS
-c, --csv Convert local CSV files to JSON before pushing.
-d, --delete Delete form templates from org that no longer have corresponding local files.
-o, --org= (required) The Salesforce org to push form templates to.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Push SharinPix form templates to Salesforce org.
Uploads SharinPix form templates from local JSON files to the connected Salesforce org. This command reads form
templates from the local directory and creates or updates corresponding records in Salesforce. Existing forms will be
updated unless the force flag is used to skip them.
EXAMPLES
Push all form templates to the default org:
$ sf sharinpix form push
Push form templates to a specific org:
$ sf sharinpix form push --target-org myorg@example.com
Push form templates and delete orphaned records:
$ sf sharinpix form push --delete
Convert CSV to JSON, then push:
$ sf sharinpix form push --csv
FLAG DESCRIPTIONS
-c, --csv Convert local CSV files to JSON before pushing.
When enabled, the command first runs the CSV-to-JSON conversion (same as
sharinpix:form:csv2json) on files in
sharinpix/forms, then proceeds to push the resulting JSON files. -d, --delete Delete form templates from org that no longer have corresponding local files.
When enabled, this flag will delete form template records from the Salesforce org if their corresponding local JSON
files are missing. Use with caution as this operation cannot be undone.
-o, --org= The Salesforce org to push form templates to.
The target Salesforce org where the SharinPix form templates will be uploaded and stored.
`sf sharinpix permission pullPull SharinPix permissions from Salesforce org.
`
USAGE
$ sf sharinpix permission pull -o [--json] [--flags-dir ]FLAGS
-o, --org= (required) The Salesforce org to pull SharinPix permissions from.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Pull SharinPix permissions from Salesforce org.
Retrieves all SharinPix permissions from the connected Salesforce org and saves them as JSON files in the local
sharinpix/permissions directory. This command fetches the permission metadata and the JSON configuration data stored
in the sharinpixJsonc field.
EXAMPLES
Pull all SharinPix permissions from the default org:
$ sf sharinpix permission pull
Pull SharinPix permissions from a specific org:
$ sf sharinpix permission pull --target-org myorg@example.com
FLAG DESCRIPTIONS
-o, --org= The Salesforce org to pull SharinPix permissions from.
The target Salesforce org containing the SharinPix permissions to be pulled.
`sf sharinpix permission pushPush SharinPix permissions to Salesforce org.
`
USAGE
$ sf sharinpix permission push -o [--json] [--flags-dir ] [-d]FLAGS
-d, --delete Delete SharinPix permissions from org that no longer have corresponding local files.
-o, --org= (required) The Salesforce org to push SharinPix permissions to.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Push SharinPix permissions to Salesforce org.
Uploads SharinPix permissions from local JSON files to the connected Salesforce org. This command reads permission
configurations from the local directory and creates or updates corresponding records in Salesforce. The
sharinpixJsonc field will be updated with the JSON configuration data.
EXAMPLES
Push all SharinPix permissions to the default org:
$ sf sharinpix permission push
Push SharinPix permissions to a specific org:
$ sf sharinpix permission push --target-org myorg@example.com
Push SharinPix permissions and delete orphaned records:
$ sf sharinpix permission push --delete
FLAG DESCRIPTIONS
-d, --delete Delete SharinPix permissions from org that no longer have corresponding local files.
When enabled, this flag will delete SharinPix permission records from the Salesforce org if their corresponding
local JSON files are missing. Use with caution as this operation cannot be undone.
-o, --org= The Salesforce org to push SharinPix permissions to.
The target Salesforce org where the SharinPix permissions will be uploaded and stored.
`sf sharinpix pullPull all SharinPix assets (forms and permissions) from Salesforce org.
`
USAGE
$ sf sharinpix pull -o [--json] [--flags-dir ]FLAGS
-o, --org= (required) The Salesforce org to pull assets from.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Pull all SharinPix assets (forms and permissions) from Salesforce org.
Retrieves all SharinPix form templates and permissions from the connected Salesforce org. This is a convenience
command that executes both sharinpix:form:pull and sharinpix:permission:pull.
EXAMPLES
Pull all assets from the default org:
$ sf sharinpix pull
Pull all assets from a specific org:
$ sf sharinpix pull --target-org myorg@example.com
FLAG DESCRIPTIONS
-o, --org= The Salesforce org to pull assets from.
The target Salesforce org containing the SharinPix assets to be pulled.
`sf sharinpix pushPush all SharinPix assets (forms and permissions) to Salesforce org.
`
USAGE
$ sf sharinpix push -o [--json] [--flags-dir ] [-d]FLAGS
-d, --delete Delete assets in the org that do not exist locally.
-o, --org= (required) The Salesforce org to push assets to.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Push all SharinPix assets (forms and permissions) to Salesforce org.
Uploads all local SharinPix form templates and permissions to the connected Salesforce org. This is a convenience
command that executes both sharinpix:form:push and sharinpix:permission:push.
EXAMPLES
Push all assets to the default org:
$ sf sharinpix push
Push all assets to a specific org:
$ sf sharinpix push --target-org myorg@example.com
Push all assets and delete missing ones from the org:
$ sf sharinpix push --delete
FLAG DESCRIPTIONS
-d, --delete Delete assets in the org that do not exist locally.
If specified, any form templates or permissions that exist in the org but not in the local project will be deleted.
-o, --org= The Salesforce org to push assets to.
The target Salesforce org where the SharinPix assets will be pushed.
`sf sharinpix settingsOpen the SharinPix settings page in a Salesforce org.
`
USAGE
$ sf sharinpix settings -o [--json] [--flags-dir ]FLAGS
-o, --org= (required) The Salesforce org to open.
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Open the SharinPix settings page in a Salesforce org.
Opens the SharinPix settings Lightning page in your default browser for the specified Salesforce org. This command is
a convenience wrapper around
sf org open with the path set to /lightning/n/sharinpix__SharinPix_setting.EXAMPLES
Open the SharinPix settings page for a specific org:
$ sf sharinpix settings --target-org myorg@example.com
FLAG DESCRIPTIONS
-o, --org= The Salesforce org to open.
The target Salesforce org (username or alias) where the SharinPix settings page should be opened.
``