How to Deal with FlowFields
The calculation of FlowFields takes a lot of time in Microsoft Dynamics NAV 2015, so you cannot update all FlowFields every time you synchronize. It is also not recommended to run RECALCFIELDS after each posting routine. This would result in a long synchronization process which is not good for the user experience. There are other options available for FlowFields.
Nightly Recalculation of FlowFields
We recommend to create a new, normal field in your Microsoft Dynamics NAV 2015 table that stores the value you want to send to the user. In a nightly task you recalculate the FlowField. If the value has changed, update your new field and do a ”MODIFY”. This sigificantly reduces data traffic.
Request a Recalculation
Sometimes it is required to have live data available. In this case, you can request a resend of FlowField data. Of course, an online connection is required to do so. First step is to provide a button in your user interface with an Action Code that marks your FlowField. A synchronization will be started immediately.
Rec:SETVALUE('Inventory', Rec:GETVALUE('Inventory'));
Rec:MODFIY(TRUE);
SYNC_DB();
Next time you synchronize, you can do the recalulation in codeunit ACF App Events.
CASE RecRef.NUMBER OF
// Other code here ...
DATABASE::Item: BEGIN
DeviceRecRef.SETTABLE(DeviceItem);
IF (DeviceFldRef.NUMBER = DeviceItem.FIELDNO(Inventory)) THEN BEGIN
//Recalculate FlowFields for this item
Item.SETRANGE("No.", DeviceItem."No.");
ItemRecRef.GETTABLE(Item);
Mgt.RECALCFIELDS(ItemRecRef);
// Do not change the current value "Inventory"
NAVAction := NAVAction::Ignore;
END;
END;
END;