Writing to a FlowField requires a comment explaining why (DC0002)

FlowFields are calculated fields whose values are derived from other data and are not stored directly. Writing to a FlowField is an unusual operation that the platform does not automatically persist. When such an assignment is made intentionally, it must be accompanied by a comment explaining the rationale and how the value is handled.

Without documentation, this pattern appears to be a mistake and will confuse future maintainers.

Example

The following code assigns a value to a FlowField without explanation:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure()
    var
        MyRecord: Record MyTable;
    begin
        MyRecord.MyFlowField := 100; // Writing to a FlowField requires a comment explaining why [DC0002]
    end;
}

To fix this, add a comment explaining the purpose:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure()
    var
        MyRecord: Record MyTable;
    begin
        // FlowField assignment: used as a temporary buffer for UI display before validation
        MyRecord.MyFlowField := 100;
    end;
}

See also

  • PC0001 - FlowFields should not be editable