Article

Bpm'online mobile bug report: Unable to load the Data column because it was not loaded

Symptoms

A photo or a file is added to the "Attachments" detail in one of the sections.

The following error occurs after synchronization:

Bpm'online mobile bug report

Type: Terrasoft.ODataException 

Message: An error occurred while processing this request. 

The message contains: It is impossible to get the value of the Data column because it was not loaded

Cause

The following code is found in the ScriptFileSaving script of the File scehma:

var data = Entity.GetColumnValue("Data") as byte[];

If you update the data in this schema (via OData) and do not specify the Data column, the system displays an error message saying it was not loaded.

This situation can occur if there is a cyclic connection in the file table (ActivityFile, OpportunityFile, etc.).

For example, an Activity column exists in the ActivityFile table, and refers to the Activity table, in which, there is the UsrActivityFile reference column, which refers to the ActivityFile table.

The mobile app tracks that and splits a single query

INSERT INTO ActivityFile (Id, Name, Data, Activity) VALUES (1, 2, 3, 4)

Into two queries:

INSERT INTO ActivityFile (Id, Name, Data) VALUES (1, 2, 3)
UPDATE ActivityFile SET Activity = 4 WHERE Id = 1

The second request does not work.

Solution

There is a workaround. Add the IgnoreSplitLogActions flag to the manifest of the nexessary table:

{
   "SyncOptions": {
      "ModelDataExportConfig": [
         {
            "Name": "ActivityFile",
            "IgnoreSplitLogActions": true
         }
      ],

As a result, the file insertion will not be split into two requests.

Necessary conditions and possible restrictions

For UIV1, it is necessary to additionally "calibrate" the schema:

if (!Terrasoft.SysSettingsValue.getBooleanValue("UseMobileUIV2")) {
    /* * Moved from UIV2 */
    Ext.define("Terrasoft.Sync.LogManager.override", {
        override: "Terrasoft.Sync.LogManager",
        /** * @private */
        ignoreSplitLogActions: function(logAction) {
            var modelName = logAction.get("ModelName");
            var manifest = Terrasoft.ApplicationConfig.manifest;
            var ignore = false;
            if (manifest.SyncOptions) {
                var modelDataExportConfig = manifest.SyncOptions.ModelDataExportConfig || [];
                for (var i = 0, ln = modelDataExportConfig.length; i < ln; i++) {
                    var modelConfig = modelDataExportConfig[i];
                    if (Ext.isObject(modelConfig) && modelConfig.Name === modelName) {
                        ignore = modelConfig.IgnoreSplitLogActions;
                        break;
                    }
                }
            }
            return ignore === true;
        },
        /** * @private */
        splitLogActions: function() {
            var firstTierActions = this.firstTierActions = [];
            var secondTierActions = this.secondTierActions = [];
            for (var i = 0, ln = this.mergedLogActions.length; i < ln; i++) {
                var logAction = this.mergedLogActions[i];
                if (this.isCreateAction(logAction) && !this.ignoreSplitLogActions(logAction)) {
                    firstTierActions.push(logAction);
                    this.splitLogActionWithLoopColumns(logAction);
                    this.splitLogActionWithBinaryColumns(logAction);
                } else {
                    secondTierActions.push(logAction);
                    if (this.isUpdateAction(logAction)) {
                        this.splitLogActionWithBinaryColumns(logAction);
                    }
                }
            }
        }
    });
}

 

Like 1

Like

Share

0 comments
Show all comments