AgilizTech’s Customization for bpm’online – Conditionally Enable / Disable Field in bpm’online mobile app

Share Button

In this blog we will be discussing on how to conditionally enable or disable a field in bpm’online mobile app.

In this third use case, the user can enter the product details, price and quantity needed, and can edit the total amount field in the order page of the mobile app. The total amount field should be an auto computed one based on the price and quantity given at order product level. To restrict this we have created a code which completely disables the ‘order total amount’ field.

bpm'online

Figure:1 By default if you add the “total order amount” in mobile page, it will be editable.

bpm'online

Figure:2 After applying the below code, the field will not be editable.

How to make changes in the page?

To apply these changes and set the corrections, you should be aware of the workplace in which the changes have to be done.

In the Custom package > MobileApplicationManifestDefaultWorkplace select the mobile app workplace where the changes need to be done.

As a business rule, the module UsrMobileDisableModelConfig must be created and you need to write the business event for accessibility.

Below is the code for this customization:

Terrasoft.sdk.Model.addBusinessRule(“Order”,{
ruleType : Terrasoft.RuleTypes.Activation,
events:[Terrasoft.BusinessRuleEvents.Load,Terrasoft.BusinessRuleEvents.ValueChanged],
triggeredByColumns : [“Id”],
conditionalColumns :[ {name :”Id”,value : “Disable All the time”} ],
dependentColumnNames : [“Amount”]

The above code will disable ‘amount’ field which stores the ‘total order value’only if the order ID field is having a value other than the value mentioned in the condition line (i.e. value of ‘Disable All the time’). In this code we have chosen ‘ID’ field as the conditional field, but you can choose a field of your choice as per the business need.

Once UsrMobileDisableModelConfig module is created, we need to place this in the
custom package >  MobileApplicationManifestDefaultWorkplace

For Example:
UsrMobileDisableModelConfig – if this Business rule is created for accessing the columns, then you will have to mention this name in Model > Object’s Page Extension section.

Below is the code:

“Models”: {
“Order”: {
“RequiredModels”: [
“Order”,
“Account”,
“OrderStatus”,
“OrderPaymentStatus”,
“OrderDeliveryStatus”,
“Currency”,
“DeliveryType”,
“PaymentType”,
“LeadType”,
“SocialMessage”,
“OrderProduct”,
“Product”,
“Unit”,
“Pricelist”,
“OrderVisa”,
“VisaStatus”
],
“ModelExtensions”: [],
“PagesExtensions”: [
” UsrMobileDisableModelConfig “, // Module Name
“UsrMobileOrderGridPageSettingsDefaultWorkplace”,
“UsrMobileOrderRecordPageSettingsDefaultWorkplace”
]
},
}

Once the above codes are implemented, the user cannot change the order amount because the field will be disabled.
Click here to navigate to the main blog post which contains the complete list of bpm’online customization use cases.

Share Button

Leave a comment

Your email address will not be published. Required fields are marked *

Bitnami