Dynamics 365 Business Central: Can we modify/extend the standard Flowfields???

Dynamics 365 Business Central

Hi, Readers.
As you know, the FlowFields are used extensively in standard codes. This is a very powerful feature in Business Central and NAV.
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:

For some types of FlowField, you can click its value on the page.

The records will be opened.

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

A common question here is whether it is possible to modify/extend standard Flowfields. Unfortunately, as of now, the answer to this question is no.

The property ‘CalcFormula’ cannot be customized. AL AL0246

But what can we do? In the current version, we can do the following three things:

1. Copy the standard Flowfield to create a new field.
For example, I copied the standard Inventory field (68; Inventory; Decimal)

Modified the CalcFormula Property, and added it to the page (you can hide the standard Inventory field)

On the page:

This method will change the Flowfield value on the page and the result after drilling down.

2. Using Security Filters
For record-level security in Business Central, you can use security filters to limit a user’s access to data in a table. A security filter describes a set of records in a table that a user has permission to access. Let’s see more details.

You create security filter by using the Business Central client. You set security filters on permission sets, which you assign to users.
I copied a standard permission set.

Select the permission set to which you want to add a security filter, and then choose Permissions.

On the Permissions page, in the row for the table data to which you want to add a security filter, select the Security Filter column to open the Table Filter page. This example is 32 Item Ledger Entry

In the Table Filter page, in the Field Number column, select the field on which you want to limit a user’s access. And in the Field Filter column, enter the value of field that you want to use to limit access.
For example: “Item Ledger Entry”.”Entry Type” = Purchase

On the Permissions page:

Finally, assign the permission set to the user.

More details: Dynamics 365 Business Central: Using Security Filters and SecurityFiltering Property

Before setting up Security Filter:

After setting up the security filter:

And users cannot remove the security filter.

This method will change the Flowfield value on the page and the result after drilling down.

3. Using OnDrillDown (Page Field) Trigger
OnDrillDown (Page Field) Trigger: Overrides the default drill-down behavior defined in the table definition for the FlowField.
We have discussed Dynamics 365 Business Central: How to prevent users from clicking on a Flowfield field (Disable Flowfield Drill-downs) before. Similar to this method, this method does not change the Flowfield value displayed on the page, but allows you to define the drill-down results yourself. Let’s look at a simple example.

Test code:

pageextension 50201 ItemListExt extends "Item List"
            trigger OnDrillDown()
                ItemLedgerEntry: Record "Item Ledger Entry";
                ItemLedgerEntry.SetRange("Item No.", Rec."No.");
                ItemLedgerEntry.SetRange("Entry Type", ItemLedgerEntry."Entry Type"::Purchase);
                if not ItemLedgerEntry.IsEmpty then
                    Page.Run(Page::"Item Ledger Entries", ItemLedgerEntry);

This method will not change the Flowfield value and will only affect the results after drilling down.

That’s all, you can choose the best method for your needs. Give it a try!!!😁


Hope this will help.

Thanks for reading.



Copied title and URL