Creatio development guide
PDF
This documentation is valid for Creatio version 7.11.0. We recommend using the newest version of Creatio documentation.

Extending the synchronization

Glossary Item Box

ATTENTION

Functions of synchronization extension are available for:

  • bpm’online version 7.7 or higher
  • Mobile application version 7.11.2 or higher.

Introduction

Synchronization modules are internal classes and could not be extended. Often it becomes necessary to limit the data transferred during synchronization in accordance with specific rules. For this, the ability to manage synchronization stages with the management class was added.

Management class of the synchronization process

To manage synchronization stages create a class inherited from the Terrasoft.SyncHandler. Main methods of the class:

shouldImportModel() – defines, whether the data will be imported for a specific model.

shouldMergeModel() – defines, whether the data will be actualized for a specific model.

shouldExportLogRecord() – defines, whether the data will be exported on a specific log record.

Example for implementing the synchronization process management class

For example, execute data export without files. For this, create a class (for example, Terrasoft.configuration.MySyncHandler) inherited from the Terrasoft.SyncHandler. In this class, override the shouldExportLogRecord() method called at data export. The implementation of the class is available below:

Ext.define("Terrasoft.configuration.MySyncHandler", {
  extend: "Terrasoft.SyncHandler",

  shouldExportLogRecord: function(logRecord) {
     var modelName = logRecord.get("ModelName");
     var syncOptions = this.syncOptions;
     if (syncOptions.ignoreActivityFile === true && modelName === "ActivityFile") {
        return false;
     } else {
        return this.callParent(arguments);
     }
  }
});

Install the instance of the created class as a handler in the AppSyncModule module:

var handler = Ext.create("Terrasoft.configuration.MySyncHandler");
Terrasoft.Sync.AppSyncModule.setHandler(handler);

If the shouldExportLogRecord() method returns false, the log record will not be exported. If the synchronization will be performed with the ignoreActivityFile: true parameter, the data of the ActivityFile object will not be exported during synchronization.

Add the following source code to perform synchronization with the ignoreActivityFile parameter:

Terrasoft.SyncUtils.synchronizeData({
  syncOptions: {
     ignoreActivityFile: true
  },
  redirect: true
});

The Terrasoft.SyncUtils.synchronizeData() method executes only data synchronization without structure. Use the Terrasoft.SyncUtils.synchronizeByPlatform() method for complete synchronization.

NOTE

Set the false value for the ignoreActivityFile parameter to export files on server at future synchronization calls.

 

 

 

© bpm'online 2002-2018.

Did you find this information useful?

How can we improve it?