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

Blocking edit page fields

Glossary Item Box

Introduction

During the development of the bpm’online custom functions you may need to block all fields and details on the page when specific condition is met. Mechanism of blocking of the edit page fields can simplify the process without creating a number of business rules.

ATTENTION

Blocking mechanism is implemented in the bpm'online version 7.11.1 or higher.

ATTENTION

You can disable the function for blocking edit page fields using the "CompleteCardLockout" option on the feature toggle page (see. "Feature Toggle. Mechanism of enabling and disabling functions"). Use the following URL to open the feature toggle page: ../0/Nui/ViewModule.aspx#BaseSchemaModuleV2/FeaturesPage. For example, https://mycompany.bpmonline.com/0/Nui/ViewModule.aspx#BaseSchemaModuleV2/FeaturesPage.

As a result of applying the clocking mechanism on the edit page, all fields and details will be blocked. If the field has binding for the enabled property in the diff array element or in the business rule, the mechanism will not block this field. Details hide buttons and menu items for performing operations with the record. A detail with an editable list still features an ability to access the object page, however all fields will be block in accordance with the business rules.

ATTENTION

The blocking mechanism is intended for blocking details with a list and an editable list. To ensure the correct operation of the mechanism for details with editable fields, create a replacement schema for this detail and control the availability of fields using the IsEnabled attribute.

To enable the blocking mechanism, set the source code of the edit page to false for the IsModelItemsEnabled model attribute:

this.set(“IsModelItemsEnabled”, false);

Or set the default value for the attribute:

"IsModelItemsEnabled": {
    dataValueType: Terrasoft.DataValueType.BOOLEAN,
    value: true,
    dependencies: [{
        columns: ["PaymentStatus"],
        methodName: "setCardLockoutStatus"
    }]
}

Additionally, to operate the locking mechanism on a specific edit page in the diff array of this page, specify the DisableControlsGenerator generator for the containers in which you want to block fields. Therefore, to block all fields of the edit page, specify the global CardContentWrapper container:

diff: /**SCHEMA_DIFF*/[
    {
        "operation": "merge",
        "name": "CardContentWrapper",
        "values": {
            "generator": "DisableControlsGenerator.generatePartial"
        }
    }
]/**SCHEMA_DIFF*/

ATTENTION

Setting the "DisableControlsGenerator.generatePartial" value to "generator" results in error when opening an edit page in section wizard.

Blocking exceptions

It is possible to exclude blocking for some fields and details. To do this, override the getDisableExclusionsDetailSchemaNames() and getDisableExclusionsColumnTags() methods. These methods return lists of fields and details that should not be blocked by the mechanism. The implementation of methods is available below:

getDisableExclusionsColumnTags: function() {
    return ["SomeField"];
}
getDisableExclusionsDetailSchemaNames: function() {
    return ["SomeDetailV2"]
}

More complex exception logic can be implemented by overriding the isModelItemEnabled() method for edit fields and the isDetailEnabled() method for details. These methods are called for each field and detail. They receive the name and return the availability signal of the field or detail. The implementation of methods is available below:

isModelItemEnabled: function(fieldName) {
    var сondition = this.get("SomeConditionAttribute");
    if (fieldName === "ExampleField" || сondition)) {
        return true;
    }
    return this.callParent(arguments);
}

isDetailEnabled: function(detailName) {   
    if (detailName === "ExampleDetail") {
        var exampleDate = this.get("Date");
        var dateNow = new Date(this.Ext.Date.now());
        var condition = this.Ext.Date.isDate(exampleDate) && exampleDate >= dateNow;
        return condition;
    }
    return this.callParent(arguments);
}

© bpm'online 2002-2019.

Did you find this information useful?

How can we improve it?