Let Business Users Activate and Deactivate Products Dynamically
Easy and dynamic approach to enabling/disabling products for any entity, market by the end users
If you need to enable or disable product(s) for a certain market and/or entity, this would normally become an admin task where it will be done either through security or valid intersections or a combination.
Using groovy, you can enable the end users to enable or disable products by entity and market (or any other dimensions that my be relevant to your business case).
Enable and Disable Products Dynamically
I’ve created a member (tagged to the SmartList that only has Yes). The idea is that the particular intersection would remain blank if the product is enabled, and only selected as ‘Yes’ when the product need to be disabled.
Let’s disable some products now, then we’ll test it out on a Revenue entry form.
I haven’t made the form time dependent but it is applicable for the year.
We need to create a simple script that fetches the disabled flag, which we’re doing by reading the data from the intersection against which we are capturing our assumptions. The ‘Products’ for which it is marked as Yes are being stored in the disabledProducts list, and we use that to check the grid on the form and enable/disable cells based on whether they belong to that product for the scenario, version, year, entity, currency, and market that is on the POV
/*RTPS:*/
Closure getMember = {String byDimName -> operation.grid.pov.find({it.dimName == byDimName}).mbrName}
List<String> disabledProducts = []
FlexibleDataGridDefinitionBuilder builder = operation.cube.flexibleDataGridDefinitionBuilder()
builder.setPov("BegBalance", "OFS_Direct Input", getMember("Scenario"), getMember("Version"), getMember("Years"), getMember("Entity"), getMember("Currency"), getMember("Market"))
builder.addColumn('Product Disabled')
builder.addRow('ILvl0Descendants(All Product)')
operation.cube.loadGrid(builder.build(), false).withCloseable { grid ->
grid.dataCellIterator.each { cell ->
if (cell.data == 1.0)
disabledProducts.add(cell.getMemberName("Product"))
}
}
operation.grid.dataCellIterator().each {
if(disabledProducts.contains(it.getMemberName("Product"))) {
it.setForceReadOnly(true)
}
}
We need to attach this script to the revenue direct entry form and to run on load.
If I change the year, all combinations will be valid since I have disabled particular combinations only for FY22. The same would happen if I change the scenario or version.
This use case can be extended to enable and/or disable particular combinations irrespective of security and even for particular time durations. You could potentially take a start date and end date (assuming that the entire month of the start date may be locked) or you could build your own particular use cases.