Migrate Context Rules Between Environments

You can migrate context rules from one environment to another, for example from a Sandbox environment to a Production environment.

You can also migrate context rules using IDX Workbench. See

The migration process migrates all data related to context rules, including:

  • Functions

  • Context Actions

  • Context Dimensions

  • Context Scopes

  • Object Level Rules

  • Rule Sets

You can migrate context rule data using the DataPack Export functionality, which is invoked by the URL to the DataPack Home Visualforce page.

The following input parameters must be appended to the URL:

  • DataPack name [ Rule | ContextDimension ]

  • Record ID for a rule or context dimension

For example:

apex/DataPacksHome?exportDataPackType=<data-pack-name>&exportData=<record-ID>

Example URL for context rule export:

apex/DataPacksHome?exportDataPackType=Rule&exportData=a2b46000000dsxM

Example URL for context dimension export:

apex/DataPacksHome?exportDataPackType=ContextDimension&exportData=a3441000000S5BA

You must export each context rule and context dimension individually. Once exported, you can create a multi-pack to bulk import all context rules and context dimensions at the same time.

Note
Note

At this time, the export of multiple context rules or context dimensions is not supported.

To migrate context rules, perform the following tasks:

  1. Export Context Rules
  2. Export Context Dimensions
  3. Create a MultiPack
  4. Import the MultiPack with Context Rules and Context Dimensions to a Different Environment

Export Context Rules

You must export each context rule individually as a JSON file. After exporting all rules, you can bulk import them to another environment using a DataPack.

This task is a step in the Migration of Context Rules Between Environments process.

  1. In the All Tabs page, click the Vlocity Rules link.
  2. Create a view that displays only context rules.
  3. Click the name of a rule you wish to export.
  4. In the browser URL line, copy the ID of the context rule.
    The context rule Id is in the browser URL following the org hostname.
  5. Append the ID to the rule export URL. The URL format is:
    https://hostname/apex/DataPacksHome?exportDataPackType=Rule&exportData=ContextRuleId

    For example:

    https://acme.visual.force.com/apex/DataPacksHome?exportDataPackType=Rule&exportData=a2I41000001qPRd
    Figure is described in the preceding text.
  6. Click Enter. The Export DataPack dialog box appears.
    The Export DataPack dialog lists a Rule and an EntityFilter.
  7. Click Next, Next.
  8. Enter the name for the context rule.
  9. Click Done.

    A JSON file is downloaded to your Downloads folder.

  10. Repeat Steps 1 - 9 for each additional context rule you wish to export.

Export Context Dimensions

You must export each context dimension individually as a JSON file. After exporting all context dimensions, you can bulk import them to another environment using a DataPack.

This task is a step in the Migration of Context Rules Between Environments process.

  1. In the All Tabs page, click the Vlocity Context Dimensions link.

    The Vlocity Context Dimensions pages displays all existing context dimensions.

  2. Click the name of a context dimension you wish to export.
  3. In the browser URL line, copy the ID of the context dimension.
    The context dimension Id is in the browser URL following the org hostname.
  4. Append the ID to the rule export URL. The URL format is:
    https://hostname/apex/DataPacksHome?exportDataPackType=ContextDimension&exportData=ContextDimensionId

    For example:

    https://acme.visual.force.com/apex/DataPacksHome?exportDataPackType=ContextDimension&exportData=a3441000000S5BA
    Figure is described in the preceding text.
  5. Click Enter.

    The Export DataPack dialog box appears.

    The Export DataPack dialog lists a Context dimension and a Context Scope.
  6. Click Next, Next.
  7. Enter the name for the context dimension.
  8. Click Done.

    A JSON file is downloaded to your Downloads folder.

  9. Repeat Steps 1 - 8 for each additional context dimension you wish to export.

Create a MultiPack

Once you have exported all context rules and context dimensions, to import all rules and dimensions to another environment at the same time, create a multipack.

This task is a step in the Migration of Context Rules Between Environments process.

  1. In the source environment, the All Tabs page, click the Vlocity DataPacks link.

    For each context rule and context dimension, a data pack is created and listed in the Vlocity DataPacks page. Use the Last Modified column to view a list of recently created datapacks.

  2. Click each data pack you wish to import to expand it and select the checkbox.
    The Vlocity DataPacks page lists Context Dimension and Rule DataPacks. Each is expanded and its component check boxes are checked.
  3. Click Create MultiPack.
  4. Enter the name for the multipack and click Next, Next, and Done.

    A JSON file with the same name is created and downloaded to your Downloads folder.

Import the MultiPack to a Different Environment

Once you have created a multipack with Context Rules and Context Dimensions, you can import it to a different environment.

This task is a step in the Migration of Context Rules Between Environments process.

  1. In the source environment, the All Tabs page, click the Vlocity DataPacks link.
  2. Click the Installed tab.
  3. Click Import From File.
  4. Browse to the location of the multipack JSON file, which is located in the Downloads folder by default.
  5. Select the file.
  6. Click Next, Next, Next, and Done.