AgilizTech’s customization for bpm’online – Look up filtration based on flag in mobile app

Share Button

In this fourth post of the series we will be discussing how to list only active products in the product selection page of the bpm’online sales enterprise edition mobile app.

The product section in mobile app has provision to activate or inactivate the products. In the desktop version if a product is inactivated, it will not list in any product selection page. In mobile page, however by default the product will be listed.

Business use case:

To display active products only in the production selection while booking orders through bpm’online mobile app.

Product:  bpm’online sales enterprise edition

Applicable for Version: 7.13 & above

Below is the desktop version of bpm’online sales enterprise wherein you can see that the Product Inactivated does not appear in the product selection page.

Fig 1: Product Inactivated

Whereas in the product selection page of the bpm’online mobile app the inactive product will be listed. This can be corrected by applying a certain code.

Fig 2: Before applying code change, product will be listed in mobile product lookup

Fig 3: After applying the code change, product will not be listed in lookup

Filtration of lookup columns based on the flag or a column is demonstrated below.

You should be knowing in which Workplace the changes need to be done. Select the workplace first to apply the changes.

In Custom package > MobileApplicationManifestDefaultWorkplace

For Example:

UsrMobileFilterModelConfig – If this is the business rule created for filtering the columns based on other columns, then you will have to mention this name in Model > Object’s Page Extension section.

Refer below code:

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

Create a module with the specified name. In this example it is UsrMobileFilterModelConfig.

In UsrMobileFilterModelConfig. module write the business event for Accessibility.

Find the code below.

Terrasoft.sdk.Model.addBusinessRule(“OrderProduct”,{
ruleType:Terrasoft.RuleTypes.Filtration,
events:[
Terrasoft.BusinessRuleEvents.Load,
Terrasoft.BusinessRuleEvents.Insert,
Terrasoft.BusinessRuleEvents.ValueChanged
],
triggeredByColumns:[“Product”],
filters:Ext.create(“Terrasoft.Filter”,{
modelName:”Product”,
property:”IsArchive”,
value:false
})
});

Here we are filtering “Product” lookup column in Order Products, based on Is Archive field in the product object. If the value is false, product will be listed; if value is correct i.e. if product is inactive, it won’t be listed. This Filtration should work while inserting new order, i.e. selecting a product for new order and while editing order product list for an existing order.

The event handling is explained below:
Find the code below.

events:[
Terrasoft.BusinessRuleEvents.Load, //On Data Load
Terrasoft.BusinessRuleEvents.Insert, //upon inserting new
Terrasoft.BusinessRuleEvents.ValueChanged //While Editing
]

Hence, if the above code is applied the inactive products will not be listed in the mobile product look up.

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