Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Model Driven MES 7​.0

Move a Work Tasks-MES configuration to another environment

Move a Work Tasks-MES configuration to another environment

  • Last UpdatedOct 10, 2025
  • 8 minute read

Standard development practice calls for you to create MES workflows in a development environment for development and testing. Then when the workflows have been tested and verified to work properly, you can move them to the production environment.

Work Tasks allows you to create packages to move workflows from one environment to another. This is the preferred method for moving workflows. For example, this is how MES model-driven application content is installed. For information about creating and importing workflow packages, see "Packages" in the Work Tasks Developer Guide, which is available in the Work Tasks help (https://help.aveva.com/worktasks/).

The only possible exception is if you are setting up a new MES production environment. Examples are if you are setting up a production environment for the first time or due to a machine failure. In this case, you can move a Work Tasks-MES configuration from a development environment to the new production environment.

The information in this topic apply only if you are creating a new production environment based on an existing development environment and you are not using the Work Tasks Connector for MES. If you are using MES Connector, see the topic "Moving a Work Tasks Configuration to Another Environment" in the Work Tasks Connector for MES Implementation Guide.

If you are attempting to move workflows or forms and their associated artifacts from a development environment to an existing production environment, you should use the Work Tasks workflow packages feature to import the workflows to the production environment. For information about creating and importing workflow packages, see "Packages" in the Work Tasks Developer Guide, which is available in the Work Tasks help (https://help.aveva.com/worktasks/).

Prerequisites

When moving Work Tasks configurations from one environment to another, observe the following prerequisites:

  • Both environments are running the same versions of Work Tasks and MES including any hotfixes.

    Note: A new Work Task farm database must be manually created in the destination environment.

  • Both environments are running SQL Server 2016 or later.

    It is recommended that both environments run the same version of SQL Server. If they are running different versions of SQL Server, the destination environment must have the later version.

  • Both environments have Chrome or Microsoft Edge installed.

Recommendations

  • Use the same repository name in the development and production environments.

    Note: Special care must be taken to review the security differences between environments (for example, the domain name and security groups) that affect MES and Work Task databases.

  • Only experienced Work Tasks and MES users should attempt moving the Work Tasks-MES configuration between environments.

Assumptions about the source environment

  • MES users have been configured.

  • MES has been configured with the required entities, items, and so on that will be used in the production environment.

  • The Work Tasks farm and repository for MES have been set up.

  • MES workflows have been created and tested to ensure that MES and Work Tasks are fully functional in this environment.

Step 1: Move the Work Tasks and MES databases to the destination environment

  1. In both environments, stop all the MES middleware services.

  2. In both environments, stop the Work Tasks service by stopping the Work Tasks – Client Service.

    This should stop all the other services related to Work Tasks. If other services are still running, stop each of them manually.

  3. In SQL Server Management Studio in the source environment, create backups of the Work Tasks farm and repository databases, and the MES database.

  4. Copy the database backups to the SQL Server node in the destination environment.

  5. If for some reason the destination environment has existing Work Tasks and MES databases, create backup copies from the destination environment.

    This step allows you to restore the old databases if there is a problem moving the Work Tasks-MES configuration.

  6. In SQL Server Management Studio in the destination environment, restore the Work Tasks repository database and the MES database.

    During the restore, you will typically use the same database names. However, you can rename the databases in the destination environment.

  7. Make sure that the database restorations are completed successfully.

Step 2: Configure the MES database in the destination environment

Note: Configure MES using the MES post-configuration tool.

  1. From the Start menu, open the post-install Configurator application.

    There are four things you need to do:

    • Validate the restored database setup.

    • Configure the MES DB/MW communication.

    • Configure the MES middleware proxy.

    • Configure the MES Web Portal.

  2. Close the Configurator.

  3. Start the MES middleware host.

  4. Configure MES security using the MES Client for the destination environment.

    Step 3: Import the Work Tasks repository into the destination environment

    The following prerequisites are assumed:

    • The Work Tasks token service has been properly configured.

    • System Platform Gateway will need to be reconfigured in the destination environment once the repository is fully restored.

    • The target repository does not have MES Connector configured.

    • The Work Tasks Repository database and MES database have been successfully moved to and restored in the destination environment using the preceding procedure.

    Perform the following procedure in the destination environment.

    1. In SQL Server Management Studio, run the following script:

      DECLARE @OldRepositoryName AS NVARCHAR(150)

      DECLARE @OldUniqueEnvironmentName AS NVARCHAR(150)

      -- Set the Old Workflow repository name

      SET @OldRepositoryName = '<Old Repository Name>'

      -- Set the Unique Environment Name - The Unique Environment Name used to initially while provisioning the workflow repository in engineering environment

      SET @OldUniqueEnvironmentName = '<UniqueEnvironmentName>'

      -- Deleting all ArchestrA external connections details entries from SKExternalConnectionDetails table

      DELETE FROM SKExternalConnectionDetails WHERE RecordParentItemId IN (SELECT Id FROM SKExternalConnections WHERE SourceType='ArchestrA' AND Application=@OldRepositoryName AND Title=@OldUniqueEnvironmentName)

      AND Application=@OldRepositoryName

      -- Deleting all ArchestrA external connections information from SKExternalConnections table

      DELETE FROM SKExternalConnections WHERE SourceType='ArchestrA' AND Application =@OldRepositoryName AND Title=@OldUniqueEnvironmentName

      -- Deleting Galaxy User resource mapping from SKESGResource Mapping table

      DELETE FROM SKESGResourceMapping WHERE UserId In(SELECT Id FROM SKVirtualActor WHERE Provider = @OldUniqueEnvironmentName AND ResourceHandler=@OldRepositoryName)

      AND Application=@OldRepositoryName

      -- Deleting galaxyuserprovider and galaxyrole provider entries from SKEntityDataSourceProvider table

      DELETE FROM SKEntityDataSourceProvider WHERE Provider='galaxyuserprovider' OR Provider='galaxyroleprovider' AND Application=@OldRepositoryName AND InstanceName=@OldUniqueEnvironmentName

      -- Deleting 'galaxyaduserprovider' and 'galaxyadroleprovider' entries from SKEntityDataSourceProvider table

      DELETE FROM SKEntityDataSourceProvider WHERE Provider='galaxyaduserprovider' OR Provider='galaxyadroleprovider' AND Application=@OldRepositoryName AND InstanceName=@OldUniqueEnvironmentName

      -- Updating SKEEventAssociations table and Setting EventBindingXML with rootnodes wherever EventBindingXML is empty

      -- This step is required to avoid the 'Root Element is missing' message while attaching the datasource and creating a repository

      UPDATE SKEEventAssociations SET EventBindingXML = '<EventBind></EventBind>' WHERE RTRIM(EventBindingXML) = '' AND Application =@OldRepositoryName AND EventProviderName='ArchestraEvents'

      -- Truncating Galaxy Role User Mappings table

      DELETE FROM GalaxyRoleUserMappings WHERE UserId IN (SELECT Id FROM GalaxyUsers where UniqueGalaxyName=@OldUniqueEnvironmentName)

      -- Deleting Galaxy Role Security Group Mappings table

      DELETE FROM GalaxyRoleSecurityGroupMappings WHERE Id IN (SELECT Id FROM GalaxyRoles WHERE GalaxyName = @OldUniqueEnvironmentName)

      -- Deleting Galaxy Roles from Galaxy Roles table

      DELETE FROM GalaxyRoles WHERE GalaxyName = @OldUniqueEnvironmentName

      -- Deleting Galaxy Users from Galaxy Users table

      DELETE FROM GalaxyUsers WHERE UniqueGalaxyName = @OldUniqueEnvironmentName

    2. In SQL Server Management Studio,run the following script against the datasource database to remove Workflow runtime data:

      truncate table SKWorkItem

      truncate table SKHWSActivity

      truncate table SKWorkItemTransaction

      delete SWTaskList where cast(ClassName as nvarchar(max)) <> 'Skelta.WorkFlow.Scheduler.WorkFlowScheduler'

      truncate table SKMultipleTimeoutWarning

      truncate table SWActionEventLog

      truncate table SWActionEventLong

      truncate table SKWorkItemCounter

      truncate table SKChannelWorkItem

      truncate table SKWorkItemData

      truncate table SKWorkItemFields

      truncate table SWExecutionDetails

      truncate table SWExecute

      truncate table SWVariables

      truncate table SKWorkflowEvents

      truncate table SKChildWorkflows

      truncate table SWCustomTimerDetails

      truncate table SWClientTokenData

    3. Open the Work Tasks Central Configuration main page and select Datasource Settings.

    4. On the Datasource List page, create a datasource that points to the restored repository database.

    5. On the Work Tasks Central Configuration main page, select Repository Settings.

    6. On the Repository List page, add the new repository by attaching the datasource as follows:

      1. In the Repository DataSource field, select the datasource added in step 3.

      2. Select Attach DataSource.

      3. For the Resource Provider property, select Active Directory.

      4. For the Repository Name, enter the source repository name.

      5. Map the repository to the servers.

      6. For the Use Token Service property, select the AIM access token registered for the MES model-driven content using the Work Tasks Central Configuration Token Service Settings page. For more information on registering AIM access tokens, see step 3 in the Configuring the Work Tasks Database and Repository Settings in the Destination Environment procedure.

      7. Clear the Enable LDAPS check box.

      8. For the Domain Name, enter the domain for the users who will be logging into the Enterprise Console.

    7. Select Test LDAP to confirm that the Resource Provider settings are properly set up to use Active Directory to access the repository.

    8. Ensure that Display Domain Name is selected.

    9. Select OK to save the repository settings.

      The Administrator Configuration page appears. Use the page to specify the repository’s administrative user:

      1. Select the Search icon, located beside the User Lookup field.

        The User Lookup dialog box appears.

      2. Type the administrator account user name (do not include the domain) in the Search For field, select Id in the list, and select Search.

        [Active Directory] appears in the Available Resources list.

      3. Add the [Active Directory] entry from the Available Resources list to the Selected Resource list and select Update.

      4. On the Administrator Configuration page, [Active Directory] is entered in the User Lookup field.

      5. Select OK.

      6. When the Administrator configured successfully message appears, select Close.

      Once completed, the Repository List page displays the new repository.

      Note: If Configure Now appears in the repository's System User column, as shown above, select Configure Now and repeat adding the repository administrator user. At the conclusion of this second attempt, [Active Directory] should appear in the repository's System User column.

    10. In the Repository List, select the Site Path link to open Enterprise Console.

      The MES model-driven application content repository appears on the Repository page. Log into Enterprise Console by selecting the Active Directory link.

      Step 4: [Optional] Migrate MES middleware extensibility hooks to the destination environment

      1. Open the MES\middleware\ MWDBMappingsCustom.xml file using a text editor on the source machine.

      2. At the end of the file, copy the entire section for the XML tag ext_hooks_objects. It will begin with <ext_hooks_objects> and end with </ext_hooks_objects>.

      3. Open the new MWDBMappingsCustom.xml file on the destination environment and replace the ext_hooks_objects XML tag with the source environment.

      4. Save the changes.

        Step 5: Copy the additional files to the destination environment

        1. Manually copy the additional file artifacts from the source environment to the destination environment.

          The additional files are:

          • CSS The CSS files for all packages.

          • Help The folders that contain the help files, by package.

          • JS The javascript files for all packages.

          • WebAPI The MES Web API v3 Open API (Swagger) JSON file.

          • Locales The localized text files for all packages, organized by the locales of the supported languages.

          • MDMTHEME Image files that are used by forms and controls for all packages.

          • MSI The additional package MSI files and the Language Installation MSI file.

          • Widget The Gantt, Merge, Split, Information Card, Progress Bar, and SPC Chart web widgets.

        2. Once complete, clear the browser cache and reset IIS.

          Step 6: Update the base address for the MES Web API

          1. From Work Tasks Enterprise Console, select Settings and then select Web API.

          2. Open the MES Web API to edit its settings.

          3. Edit the Base Address setting to the base address for the destination environment.

            Step 7: Verify the workflows in the destination environment

            1. From Work Tasks Enterprise Console, log in to the MES repository.

            2. Verify that the workflows and other artifacts from the source environment are present.

            3. Close Work Tasks and restart the machine.

            4. Open Work Tasks and test run each workflow to make sure the expected data is stored in the MES database.

              In This Topic
              TitleResults for “How to create a CRG?”Also Available in