AgilizTech’s Customizations for Creatio (formerly bpm’online) – Conditionally Hide/Show Fields in bpm’online mobile app
In the second post of this series, we will be exploring a way to achieve conditional visibility of fields in the sales Creatio enterprise edition mobile app.
Let us take a scenario where the Sales Manager is approving an order in the mobile app. As per business rule, once the Manager has approved the order, he should not be able to reject it. Currently, for approval purpose, ‘Order approvals’ detail is added in ‘order section’ in mobile app. The app allows manager to choose appropriate status in this detail (‘Approved’ or ‘Rejected’). By default, the status will be ‘To Set’. App allows manager to choose ‘Approved’ or ‘Rejected’ status, even after the order has been approved or rejected, which is incorrect as per business rule.
We can correct this workflow by hiding the ‘order approval’ status option once the order has been approved/rejected.
Here are the steps to achieve this:
1. In the System Designer, navigate to Advanced Settings and select Configuration.
2. Here, in Custom Package, select the Mobile App Workplace, where you want the change to be in effect (here we have mentioned default workplace; if you have created a separate workplace for approvals, select the same).
For example, Custom package > MobileApplicationManifestDefaultWorkplace
3. Mention the visibility Module name in the object’s Page Extensions Section.
For Example:
UsrOrderMobileBusinessRules – If this is the business rule created for hiding the columns, then mention this name in Model > Object’s Page Extension section.
Here’s the code:
“Order”: { {
“RequiredModels”: [
“Order”,
“Account”,
“OrderStatus”,
“OrderPaymentStatus”,
“OrderDeliveryStatus”,
“Currency”,
“DeliveryType”,
“PaymentType”,
“LeadType”,
“SocialMessage”,
“OrderProduct”,
“Product”,
“Unit”,
“Pricelist”,
“OrderVisa”,
“VisaStatus”
],
“ModelExtensions”: [],
“PagesExtensions”: [
” UsrOrderMobileBusinessRules “, // Module Name
“UsrMobileOrderGridPageSettingsDefaultWorkplace”,
“UsrMobileOrderRecordPageSettingsDefaultWorkplace”
]
},
//As we are hiding the ‘OrderVisa’ Status Field in the order screen, the OrderVisa Object is //also required. In the Model Extension, we have also given VisaStatus Object as this is a //lookup table for OrderVisa table’s Status field.
“OrderVisa”:{
“ModelExtensions”: [
“VisaStatus”
],
“PagesExtensions”: []
},
}
In the UsrOrderMobileBusinessRules module, write the business event for visibility.
The code is as given:
ruleType: Terrasoft.RuleTypes.Visibility,
events:[Terrasoft.BusinessRuleEvents.Load],
conditionalColumns: [
{name: “Status” , value: “3462594d-77a7-4b0a-874a-6d8b54b293bc”}
],
triggeredByColumns: [ “Status” ] ,
dependentColumnNames: [ “Status” ]
});
Here we are displaying Status field, if the status is ‘To Set’. In case of the other two statuses, (i.e. ‘Approved’ & ‘Rejected’) the ‘Order Approval’ detail, with ‘Status’ field will be hidden, which will stop the manager from changing the status of an approved order to rejected or vice-versa.
The ID value of ‘status’ is hard coded in the above code. The ID value may be different in different instances; hence the value should be cross verified while using this code snippet.
Click here to navigate to the main blog post which contains the complete list of Creatio (formerly bpm’online) customization use cases.