Export and Import Omniscripts

Export or import Omniscripts to use them in another org, such as when you create them in a sandbox or to use sample data packs that Salesforce provides. When exporting or importing data packs for Omniscripts, if you encounter Apex limit errors such as heap or CPU limits, reduce the size of the data pack by unselecting dependencies during the export process. Additionally, break the data pack into multiple smaller data packs. As a best practice, we recommend including no more than 10 elements in each data pack.

Export an Omniscript

To export an Omniscript in the new designer on the standard runtime, use the Salesforce CLI. Omnistudio exports the file in JSON format.

Before you begin:

  1. From a terminal in VS Code, enter this command, and replace the variables with values for your org.
    sf data export tree --query "SELECT IsMetadataCacheDisabled, IsTestProcedure, Description, OverrideKey, Name, OmniProcessKey, Language, PropertySetConfig, LastPreviewPage, OmniProcessType, ElementTypeComponentMapping, SubType, ResponseCacheType, IsOmniScriptEmbeddable, CustomJavaScript, IsIntegrationProcedure, VersionNumber, DesignerCustomizationType, Namespace, Type, RequiredPermission, WebComponentKey, IsWebCompEnabled,(SELECT Description, DesignerCustomizationType, Name, EmbeddedOmniScriptKey, IsActive, Type, ParentElementId, PropertySetConfig, SequenceNumber, Level, Id from OmniProcessElements) from OmniProcess where OmniProcessType='OmniScript' and id='omniscript_id'" --target-org org_alias --plan --output-dir export_directory
    Note
    Note

    Don't include the isActive field on OmniProcess when you export the Omniscript.

    org_alias
    The alias of the org from where you’re exporting.
    export_directory
    The directory in the project where the exported JSON is stored.
    omniscript_id
    The ID of the Omniscript that you want to export.
  2. Verify whether the JSON file is downloaded in the export directory.

Import an Omniscript

To import an Omniscript in the new designer on the standard runtime, use the Salesforce CLI.

Before you begin:

From a terminal in VS Code, enter this command, and replace the variables with values for your org.
sf data import tree --plan ./export_directory/OmniProcess-OmniProcessElement-plan.json --target-org org_alias
org_alias
The alias of the org where you’re importing.
export_directory
The directory in the project where the exported JSON is stored.
Note
Note

If the exported JSON file has isActive=true, the import operation fails.

Export an Omniscript from the Designer on a Managed Package

Export Omniscripts in a data pack to share them with other Salesforce orgs.

  1. From the App Launcher, find and select Omniscripts.
  2. Expand an Omniscript and select the version to export.
  3. Click actions menu icon, and then select Export.
  4. Follow the instructions and enter the information as needed.
  5. To store the data pack and access it from Omni DataPacks, select Add To Library.
  6. To store the data pack on your local machine, select Download.
  7. Click Done.

Import an Omniscript to the Designer on a Managed Package

If you're using the designer on a managed package, add existing Omniscripts to an org by importing them with a data pack.

  1. From the App Launcher, find and select Omniscripts.
  2. Click Import and then follow the instructions.