Edit page with specified set of columns
Glossary Item Box
ATTENTION This article is relevant to the bpm’online version 7.11.2 or higher and for mobile application version 7.11.4 or higher. |
Introduction
It often becomes necessary to open an edit page of the section record with one or several columns. For example, in the [Cases] section, after executing the [Escalate] action, open the page with following columns: [Support line], [Assignee] and [Assignee group]. The example of this page for bpm’online web application is given on Fig. 1.
Fig. 1. Case escalation page
For implementation of this page in the mobile application, the Terrasoft.configuration.controller.EditPage controller class was added. The class enables to create a page which columns and business rules are created not on the base of model settings or SDK, but on the base of configuration object defined in the config property of the class.
Example
For example, in the mobile application create an escalation page with following columns: [Support line], [Assignee] and [Assignee group].
For this, create a controller class (for example, in the UsrCaseEditPage schema) inherited from the Terrasoft.configuration.controller.EditPage. The source code of the class:
Ext.define("Terrasoft.configuration.controller.CaseEscalationPage", { extend: "Terrasoft.configuration.controller.EditPage", config: { refs: { view: "#CaseEscalationPage" }, businessRuleConfigs: [ { name: "CaseEscalationOwnerOrGroupRequirementRule", ruleType: Terrasoft.RuleTypes.Requirement, requireType: Terrasoft.RequirementTypes.OneOf, events: [Terrasoft.BusinessRuleEvents.Save, Terrasoft.BusinessRuleEvents.ValueChanged], triggeredByColumns: ["Owner", "Group"] } ], columnConfigs: [ { name: "SupportLevel" }, { name: "Owner", customEditConfig: { required: true } }, { name: "Group", customEditConfig: { required: true } } ] }, statics: { Model: Case } });
The businessRuleConfigs configuration property receives the array of business rules settings. The setting corresponds to the call of the SDK method:
Terrasoft.sdk.Model.addBusinessRule("Case", businessRuleConfig);
The columnConfigs configuration property receives the array of column settings. The setting corresponds to the call of the SDK method:
Terrasoft.sdk.RecordPage.addColumn("Case", columnConfig);
Controller also supports the useModelBusinessRules configuration property. The property defines whether business rules from the model that are configured using the SDK will be used.
After that, create view class and add the page to cache:
Ext.define("Terrasoft.configuration.view.CaseEscalationPage", { extend: "Terrasoft.view.BaseEditPage", config: { id: "CaseEscalationPage" } }); Terrasoft.PageCache.addItem("CaseEscalationPage", { controllerName: "Terrasoft.configuration.controller.CaseEscalationPage", pageSchemaName: "CaseEscalationPage", viewXClass: "Terrasoft.configuration.view.CaseEscalationPage" });
NOTE All provided source code can be located in one module schema, for example in the UsrCaseEditPage schema. |
To open the page, add the following code to any event handler (for example, pressing the button, preforming action, etc.):
Terrasoft.util.openCachedPage("CaseEscalationPage", { recordId: "0fa67d76-8cc2-4e5b-bd3e-36d16741b06a" });
recordId – the Id of the section record that is opened in the page. In this case, it is the value of the Id column of the Case object.
As a result the page with the specified set of columns will be opened in the mobile application (Fig. 2).
Fig. 2. Page with specified set of columns