Як встановити ознаку змінити значення змінної при відкриті запису з мобільного додатку Freedom UI

Please help.

I created an object called UsrAppMobNotifications, which includes a Boolean variable UsrBoolRead. In the mobile application version 8.1, I need to set up a business rule so that when a user opens a record of this object, the UsrBoolRead variable becomes true.

 

The code of the mobile app's record page (UsrMobileUsrAppMobNotificationsRecordPageSettingsPortal) doesn't contain any blocks (like handlers).

Question 1: How can I add my own business rule?

Question 2: I tried to create a rule based on examples, but it doesn't work.



My rule^

Terrasoft.sdk.Model.addBusinessRule("UsrAppMobNotifications", {

name: "SetUsrBoolReadTrueRule",

ruleType: Terrasoft.RuleTypes.Custom,

events: [Terrasoft.BusinessRuleEvents.Load],

executeFn: function(model, rule, column, customData, callbackConfig) {

model.set("UsrBoolRead", true);

Ext.callback(callbackConfig.success, callbackConfig.scope);

}

});

Like 0

Like

1 comments

Hello.

Please be advised that adding business rules to a page using the Terrasoft.sdk.Model.addBusinessRule(name, config) method is only supported on the old user interface. Unfortunately, the feature to create business rules on the mobile application is not yet available, as it is currently under development. However, I can assist you in setting up card-level business rules, that might be helpful for you.

At the moment, the difference between the rules on the card and the model is insignificant. Namely, the difference is that the card has Visibility rules that can show or hide card elements. Therefore, let's consider this particular example, and try to hide a column under a condition.

1. Set up the rules in the web.

2. The names of the controls ("Code" and "Element code") must be given according to the names of the columns. That is, if the column is called UsrText, then the control should be called that way (because the names are generated by the web by default):

3. The rule that hides the UsrText field can be configured as follows:

When saving, do not forget to click Save in the card itself.

4. Add a new (or existing) section in the mobile application wizard and configure the card properly.

5. Go to the Configuration (WorkspaceExplorer) and look for the card setup scheme (scheme name format: Mobile[Object name]RecordPageSettings[Workspace name]):

In this case, the object name is Rules.

6. Open this schema. Open its metadata (Actions → Open metadata) and look at its metadata (Metadata (Read-Only) section) and copy its Uid, PackageUid and CreatedInPackageUId.



7. Export the rules configured in step 3.

8. This metadata needs to be slightly adapted to the mobile platform. Open the downloaded metadata file and make the following changes:

а) Change the Uid. You can either generate it or simply change a few digits/characters in the current value. The old UId must be changed throughout the scheme (at least 2).

b) Give a new name to the Addon in Name and A2. The format will be as follows: [Object name]RecordPageSettingsBusinessRule (for example, RulesRecordPageSettingsBusinessRule).

c) Replace all "EntitySchemaManager" with "ClientUnitSchemaManager", if any.

d) In B6, write the PackageUId from step 6.

e) In AD1 and TargetSchemaUId, write the UId from step 6.

f) In A5 we write the CreatedInPackageUId from step 6.

g) Replace all the names of the controls generated on the web with the corresponding column names. You can search for them using the following masks: LookupAttribute_, Input_, ComboBox_.

For example, instead of LookupAttribute_6wy705z, you should use UsrContactType.

h) Save the changes.

9. Import this modified schema. Select the desired package in the Configuration, click "Add" and select the "Import" item in the list (at the moment it is the last in the list).

As a result, in the package in which this section was added in the mobile application wizard, an Addon scheme with rules that are linked to the card configuration scheme in the mobile application should appear.

10. After that, synchronize the mobile app with Creatio and check the rule's operation.

Show all comments