Skip to content

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

plugin-tableau-next

NPM Downloads/week License

Salesforce CLI plugin that copies Tableau Next dashboards, visualizations, semantic models, or a workspace's assets from one org to another.

sf tableau-next export --source-org my-sbx --target-org my-prod --dashboard Superstore_Dashboard
sf tableau-next export --source-org my-sbx --target-org my-prod --dashboard Sales_Dashboard --dashboard Service_Dashboard --with-dependencies
sf tableau-next import --target-org my-prod --destination-workspace Sales --file export_20261008T221500Z.zip --dry-run
sf tableau-next import --target-org my-prod --destination-workspace Sales --file export_20261008T221500Z.zip

Install

sf plugins install @salesforce/plugin-tableau-next@x.y.z

How it works

Export calls the source org's metadata export API (POST /app-assets/action/metadata-export, release 264 or later) at the lower of the two orgs' release versions (for example 68.07 and 68.00 → 68.00), so the target org can accept it. The server reads each asset, downgrades it, converts it to its create body and lists what it depends on. --target-org is only used to read the target's version; use --target-version instead if you can't log in to the target. The zip the server returns is written unchanged as export_<UTC yyyyMMdd'T'HHmmss'Z'>.zip (-1, -2... is added rather than replace an existing file): a manifest.json plus, for each asset, <folder>/<API name>/payload.json (the POST-ready body) and metadata.json (what it depends on). Assets are named by API name, never by record id.

--dashboard, --visualization and --semantic-model can be repeated and combined. Every asset named goes into one API call and one file (at most 200 assets, dependencies included). --workspace is used on its own.

With --with-dependencies, what the assets use is exported into the same file too, recursively: a dashboard's visualizations, the semantic models they use, and the base models those extend. Import then creates them in order and points each asset at the new ids, so you don't edit the file. Data 360 tables are never copied; they must already exist in the target. The dependencies may come from other workspaces: if one already exists in the target org in a different workspace, import stops (even with --overwrite), so export without --with-dependencies to link to the target's copy instead.

With --workspace, the file holds every asset the workspace created and what those assets use. Assets the workspace only references live in another workspace and aren't exported. Import into an existing workspace with --destination-workspace.

Import reads the zip (or a .json file written by earlier versions of the plugin) and checks everything before writing anything:

  1. The file's version is not newer than the target org.
  2. The destination workspace exists.
  3. Every dependency that isn't in the file exists in the target under the same API name (a visualization's semantic model; a dashboard's visualizations, and the semantic models behind filter/parameter widgets and tokens).
  4. If any asset in the file already exists, the import fails and lists them all, unless --overwrite is passed. The same check runs with --dry-run. Import never prompts.

It then switches every reference from source-org ids to target-org ids (looked up by name) and creates (POST) or updates (PATCH) the asset.

Debugging

Set SF_LOG_LEVEL=debug to see what the plugin did, step by step:

SF_LOG_LEVEL=debug sf tableau-next import --target-org my-prod --destination-workspace Sales --file export_20261008T221500Z.zip
grep '"name":"sf:tableau-next' "$(ls -t ~/.sf/sf-*.log | head -1)"

The lines go to the sf CLI log file, ~/.sf/sf-<UTC date>.log, as JSON, not to the terminal. They show:

  • Every REST call: method, path, how long it took, how many bytes were sent, and the error code and status if it failed.
  • Export: the two org versions and the one used, the export call and the assets it asked for, and what each asset depends on.
  • Import: the versions, the workspace id, the target id of each dependency, which assets already exist, the Data 360 table and dataspace checks, the plan, the ids each body points at, and each saved id.

Only names, ids, counts, versions and error codes are logged, never request or response bodies. The sf CLI removes access tokens from the log.

Issues

Please report any issues at https://github.com/forcedotcom/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.

See CONTRIBUTING for more.

CLA

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.

Build

To build the plugin locally, make sure to have yarn installed and run the following commands:

# Clone the repository
git clone git@github.com:salesforcecli/plugin-tableau-next

# Install the dependencies and compile
yarn && yarn build

yarn test runs the unit tests, lint, and the schema, command-snapshot and command-reference checks; no org is needed.

To use your plugin, run using the local ./bin/dev.js or ./bin/dev.cmd file.

# Run using local run file.
./bin/dev.js tableau-next export --help

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.

# Link your plugin to the sf cli
sf plugins link .
# To verify
sf plugins

Commands

sf tableau-next export

Export Tableau Next dashboards, visualizations, semantic models, or a workspace to one file, ready to import into another org.

USAGE
  $ sf tableau-next export -s <value> [--json] [--flags-dir <value>] [-o <value>] [--target-version <value>] [--workspace
    <value> | --dashboard <value>... | --visualization <value>... | --semantic-model <value>...] [--with-dependencies]
    [--api-version <value>] [-d <value>]

FLAGS
  -d, --output-dir=<value>         [default: .] Directory to write the export file to.
  -o, --target-org=<value>         Username or alias of the org you'll import into. Only its version is read; nothing is
                                   written to it.
  -s, --source-org=<value>         (required) Username or alias of the org to export from.
      --api-version=<value>        Override the API version used for API requests made by this command.
      --dashboard=<value>...       API name of a dashboard to export. Repeat to export several.
      --semantic-model=<value>...  API name of a semantic model to export. Repeat to export several.
      --target-version=<value>     Release version of the org you'll import into, for example 68.07 (release 68, patch
                                   7). Use instead of --target-org.
      --visualization=<value>...   API name of a visualization to export. Repeat to export several.
      --with-dependencies          Also export what the assets depend on (visualizations, semantic models, base models),
                                   into the same file.
      --workspace=<value>          API name of the workspace to export. Can't be combined with the other asset flags.
                                   The file holds the assets the workspace created, not the workspace itself.

GLOBAL FLAGS
  --flags-dir=<value>  Import flag values from a directory.
  --json               Format output as json.

DESCRIPTION
  Export Tableau Next dashboards, visualizations, semantic models, or a workspace to one file, ready to import into
  another org.

  Exports the assets with one call to the source org's Tableau Next metadata export API (release 264 or later), at a
  version the target org can accept: the lower of the source and target release versions (for example 68.07 vs 68.00
  exports at 68.00). Pass --target-org to look up the target version, or --target-version if you can't log in to the
  target org.

  Writes the zip file the export API returns, unchanged, as `export_<UTC yyyyMMdd'T'HHmmss'Z'>.zip` (with `-1`, `-2`...
  added if that file already exists). It holds a manifest and, for each asset, its create body and what it depends on.
  Anything the file's assets depend on that isn't in the file (a visualization's semantic model, a dashboard's
  visualizations and semantic models, or the base models a semantic model extends) must already exist in the target org;
  import checks these before writing anything.

  Name what to export with at least one asset flag: either --workspace on its own, or any of --dashboard,
  --visualization, and --semantic-model. Pass those three as many times as you like, and combine them: every asset named
  goes into the same call and the same file, up to 200 assets including dependencies.

  With --with-dependencies, what the assets depend on is exported into the same file too, recursively: a dashboard's
  visualizations, the semantic models they use and the base models those extend. One import then brings them all and
  links them together. Models in any dataspace can be exported; the target org needs a dataspace with the same name and
  prefix. Partial models can't be exported.

  With --workspace, the file holds the dashboards, visualizations, and semantic models the workspace created, and what
  they depend on. Assets the workspace only references belong to another workspace, so they aren't exported. Import the
  file with --destination-workspace; the workspace must already exist in the target org.

EXAMPLES
  Export a dashboard from a sandbox for import into production:

    $ sf tableau-next export --source-org my-sbx --target-org my-prod --dashboard Superstore_Dashboard

  Export a visualization for a target org at version 68.00, into the exports folder:

    $ sf tableau-next export --source-org my-sbx --target-version 68.0 --visualization Sales_By_Category \
      --output-dir exports

  Export a dashboard together with its visualizations and semantic models:

    $ sf tableau-next export --source-org my-sbx --target-org my-prod --dashboard Superstore_Dashboard \
      --with-dependencies

  Export two dashboards and a visualization into one file, with what they depend on:

    $ sf tableau-next export --source-org my-sbx --target-org my-prod --dashboard Sales_Dashboard --dashboard \
      Service_Dashboard --visualization Pipeline_Trend --with-dependencies

  Export one semantic model:

    $ sf tableau-next export --source-org my-sbx --target-org my-prod --semantic-model Superstore_Sales

  Export everything a workspace created, with what its assets use:

    $ sf tableau-next export --source-org my-sbx --target-org my-prod --workspace Sales_Workspace

FLAG DESCRIPTIONS
  --api-version=<value>  Override the API version used for API requests made by this command.

    Caps the version export reads at: if it's a lower release than the source and target orgs, the file is read at that
    release (patch 00), and the export API is called with this version. Must be 68.0 or later, the first API version
    with the metadata export API.

See code: src/commands/tableau-next/export.ts

sf tableau-next import

Import Tableau Next dashboards, visualizations, and semantic models from an export file into an org.

USAGE
  $ sf tableau-next import -o <value> --destination-workspace <value> -f <value> [--json] [--flags-dir <value>]
    [--api-version <value>] [--dry-run] [--overwrite]

FLAGS
  -f, --file=<value>                   (required) Export file created by "tableau-next export" (a .zip, or a .json from
                                       earlier versions of the plugin).
  -o, --target-org=<value>             (required) Username or alias of the target org. Not required if the `target-org`
                                       configuration variable is already set.
      --api-version=<value>            Override the API version used for API requests made by this command.
      --destination-workspace=<value>  (required) API name or ID of the workspace to import into. It must already exist.
      --dry-run                        Check everything and report what would be created or updated, without writing.
                                       Fails if an asset already exists, unless --overwrite is passed; add --overwrite
                                       to preview updates.
      --overwrite                      Update assets that already exist in the destination workspace. Without it, the
                                       import fails if any of them exists.

GLOBAL FLAGS
  --flags-dir=<value>  Import flag values from a directory.
  --json               Format output as json.

DESCRIPTION
  Import Tableau Next dashboards, visualizations, and semantic models from an export file into an org.

  Creates the file's assets in the destination workspace (with --overwrite, updating those that already exist there).
  Before writing anything, checks that the target org's version can accept the file, that the workspace exists, and that
  everything the assets depend on (semantic models, visualizations) exists under the same API names.

  Assets in the file are imported in order: semantic models (base models first), then visualizations, then dashboards.
  Each one is linked to the assets saved before it, so what the file carries doesn't need to exist in the target org
  beforehand. A semantic model is created, or replaced in full if it already exists; definitions missing from the file
  are removed from the target model. The model's allowUnmapped setting is taken from the file; when the file doesn't
  carry it, the model is saved with allowUnmapped true.

  If any asset in the file already exists in the destination workspace, the import stops before writing anything and
  lists them; pass --overwrite to update them instead. API names are unique across the org, so an existing asset must
  have been created in the destination workspace; if it was created in another workspace the import stops before writing
  anything, even with --overwrite. The semantic models and visualizations it depends on may be in any workspace. Use
  --dry-run to check everything without writing anything: with --overwrite it reports what would be created or updated,
  without it it fails the same way if an asset already exists.

  Assets are saved one at a time. If a save fails, the import stops and the error lists each asset in the file: saved
  (created or updated, with its id), failed, or not attempted (with --json, in the error's data as "saved" and
  "notSaved"). Nothing is rolled back. If some assets were saved, the command exits with code 68 (partial success)
  instead of 1.

  To retry, fix the cause and run the same command again with --overwrite: the saved assets are now in the destination
  workspace, so without it the import stops before writing anything. The retry updates the saved assets in place (same
  ids, no duplicates) and creates or updates the rest. Until it succeeds, the target mixes versions: what was saved has
  the file's version, and what wasn't keeps its previous version. The retry also overwrites any changes made in the
  target to the saved assets since the failed run. Run it with --dry-run first to see what it will create and update. If
  you can't fix the cause, the assets created before the failure stay in the workspace; delete them by hand.

EXAMPLES
  Preview an import into production:

    $ sf tableau-next import --target-org my-prod --destination-workspace Sales --file export_20261008T221500Z.zip \
      --dry-run

  Preview an import that updates assets already in the workspace (without --overwrite, the dry run fails on them):

    $ sf tableau-next import --target-org my-prod --destination-workspace Sales --file export_20261008T221500Z.zip \
      --dry-run --overwrite

  Import, overwriting the assets that already exist:

    $ sf tableau-next import --target-org my-prod --destination-workspace Sales --file export_20261008T221500Z.zip \
      --overwrite

FLAG DESCRIPTIONS
  --api-version=<value>  Override the API version used for API requests made by this command.

    Used for the checks import makes in the target org. Assets are written at the version the export file was read at,
    so this can't be lower than that version.

See code: src/commands/tableau-next/import.ts

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages