Dynamics 365 Business Central: How to prevent users from clicking on a Flowfield field (Disable Flowfield Drill-downs)

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about a topic that was asked before, how to prevent users from clicking on a Flowfield field (Disable Flowfield Drill-downs).

FlowFields display the result of the calculation described in the CalcFormula Property. For example, the Inventory field in the Item table shows the current inventory of the item and is calculated as the sum of the Quantity fields for all Item Ledger Entries in this item.

Source Code in Item table: FieldClass Property and CalcFormula Property

More details about FlowFields in Business Central: FlowFields (Sum, Average, Exist, Count, Min, Max, Lookup)

Drill-downs are a system-wide feature of FlowFields that let you see the underlying transactions that make up the information shown in the FlowField. For example, if the FlowField shows an account balance, then providing a drill-down for this text box lets the user quickly see the various transactions that make up the balance shown in the field.

The same goes for the Inventory field in the Item table.

So can we prohibit this behavior? Users can see the value of Flowfield on the page, but users are not allowed to click to view details. Yes, of cource.

There are two ways here.
The first is through permission management. In Dynamics 365 Business Central: What happens if users don’t have permission to read the table set in a FlowField?, we briefly discussed that the UI element will be removed at runtime if the user does not have permissions to a certain object. So we can’t disable table permissions, we need to disable page permissions.
For example, Inventory field in the Item table

Permission Set:

User:

Let’s simply test it.

Great.

Sorry, the current permissions prevented the action. (Page 38 Item Ledger Entries Execute: Base Application)
Page Item Ledger Entries has to close.

The second method is customization. We only need to add any code in the OnDrillDown (Page Field) Trigger of the Flowfield field.
For example, it is not necessary to use Error(Text [, Any,…]) Method, you can also use Message(Text [, Any,…]) Method.

If you want to prevent users from drilling down but don’t want any information to pop up, you can use Error(”);

Very simple, give it a try!!!😁

PS:
1. Dynamics 365 Business Central: How to check whether a field is a Flowfield via AL (Check the class of the field)

2. Dynamics 365 Business Central: A flow field is part of the query column list, this is not supported (Flowfield based on Flowfield)

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL