Hi, Readers.
Today I would like to share another mini tip about Business Central, how to make the same column editable or non-editable based on different conditions on the list page (Dynamic Editable Control for the Same Column)
While discussing requirements with a customer recently, I received a unique request.
In a list page, they want a specific column to be editable only for rows that meet certain conditions, and non-editable for all other rows.
Is this possible to achieve? Please note that we don’t want an error message; the field should simply be non-editable from the start.
We have previously discussed some similar requirements, such as:
- Dynamic Visibility of Controls (Hide and show fields dynamically)
- Add new actions (Show more and Show less) to show and hide subgroups on the page
In conclusion, yes, this is absolutely possible to achieve. Let’s look at a simple example.
I have added a new custom field, “Editable Description” (Boolean), to the “Units of Measure” page (Page 209, List).
The goal is to use this new field to dynamically control the editability of the standard “Description” field.
Specifically, the standard “Description” field should be editable only for rows where this new field is checked, and remain non-editable for all other lines.

Let’s watch a test video.
The implementation is quite simple, you just need to control the Editable property using a variable.
While you could technically use the field value directly, I created a new variable here to make it easier to understand.

Great. Give it a try!!!😁
My test code: for reference only
tableextension 50117 UnitofMeasureExt extends "Unit of Measure"
{
fields
{
field(50100; "Editable Description"; Boolean)
{
Caption = 'Editable Description';
DataClassification = CustomerContent;
}
}
}
pageextension 50117 UnitofMeasureListExt extends "Units of Measure"
{
layout
{
modify(Description)
{
Editable = EditableDesc;
}
addafter("Description")
{
field("Editable Description"; Rec."Editable Description")
{
ApplicationArea = All;
Caption = 'Editable Description';
ToolTip = 'Indicates whether the description can be edited.';
trigger OnValidate()
begin
EditableDesc := Rec."Editable Description";
end;
}
}
}
trigger OnAfterGetRecord()
begin
EditableDesc := Rec."Editable Description";
end;
var
EditableDesc: Boolean;
}END
Hope this will help.
Thanks for reading.
ZHU




コメント