Hi, Readers.
Recently I was asked an interesting question, can we edit data directly in Faxbox? In today’s post, let’s talk briefly about this.
A FactBox is the area that is located on the right-most side of a page and it is divided into one or more parts that are arranged vertically. This area is used to display content including other pages, charts, and system parts such as Notes, and Links. Typically, you can use a FactBox to display information that is related to an item on the main content page. For example, on a page that shows a sales order list, you can use a FactBox to show sell-to customer sales history for a selected sales order in the list as shown below. More details: Adding a FactBox to a Page

So we have always understood that Factbox displays content, but is it possible to modify the data directly? In conclusion, this cannot be done as of now, even through customization (Do not consider control add-in objects such as Javascript), the content in the Factbox is not editable. This is because Factbox is only used to display data.
However, if users want to edit, is there a way to handle that?
This usually has several workaround solutions.
1. Importing from external files
Item Picture (346, CardPart) is a good example. Although we cannot edit the picture directly, we can upload, download or delete them through actions.

You can also import data via CSV, Text, XML or Excel files. This will modify what is being displayed in the Factbox. For example, How to bulk import marketing text to items – Customization
2. Open the edit page through an action or trigger (such as OnAssistEdit trigger)
Most standard functionality is handled this way. Let’s look at a few examples:
Item Attributes Factbox (9110, ListPart):


Notes (SystemPart):


Let’s look at a practical example: Display all payment methods on the sales order. Click on the code or description to pop up the modification page. After modification, the changes will be reflected in the current fact box.




Great.

Test video:
Test code: Github (Please note that the source code is for reference only, you can improve it according to your own needs)
pageextension 50122 SalesOrderListExt extends "Sales Order"
{
layout
{
addbefore(Control1902018507)
{
part("Payment Methods"; "Payment Methods Factbox")
{
ApplicationArea = All;
Caption = 'Payment Methods';
}
}
}
}
page 50122 "Payment Methods Factbox"
{
Caption = 'Payment Methods';
LinksAllowed = false;
PageType = ListPart;
Editable = true;
SourceTable = "Payment Method";
layout
{
area(content)
{
repeater(Group)
{
field(Code; Rec.Code)
{
ApplicationArea = All;
ToolTip = 'Specifies the code of the payment method.';
trigger OnAssistEdit()
var
PaymentMethod: Record "Payment Method";
begin
PaymentMethod.Reset();
PaymentMethod.SetRange(Code, Rec.Code);
Page.Run(Page::"Payment Methods", PaymentMethod);
end;
}
field(Description; Rec.Description)
{
ApplicationArea = All;
ToolTip = 'Specifies the description of the payment method.';
trigger OnAssistEdit()
var
PaymentMethod: Record "Payment Method";
begin
PaymentMethod.Reset();
PaymentMethod.SetRange(Code, Rec.Code);
Page.Run(Page::"Payment Methods", PaymentMethod);
end;
}
}
}
}
}One more: In fact, you can also modify it directly through an action or trigger, similar to the second method, provided that the content of the modification is fixed. Let’s look at an interesting example: Use the plus and minus signs to adjust the amount, plus or minus 1000 each time.

Test video: Of course, this can also be fixed text, numbers, calculation results, or data from other tables, etc.
Great, give it a try!!!😁
Test code: Github (Please note that the source code is for reference only, you can improve it according to your own needs)
tableextension 50112 PaymentMethodExt extends "Payment Method"
{
fields
{
field(50000; "Payment Cap"; Decimal)
{
Caption = 'Payment Cap';
DataClassification = CustomerContent;
}
field(50001; Plus; Text[10])
{
Caption = 'Plus';
InitValue = '➕';
DataClassification = CustomerContent;
}
field(50002; Minus; Text[10])
{
Caption = 'Minus';
InitValue = '➖';
DataClassification = CustomerContent;
}
}
}
pageextension 50112 PaymentMethodsExt extends "Payment Methods"
{
layout
{
addafter(Code)
{
field("Payment Cap"; Rec."Payment Cap")
{
ApplicationArea = All;
ToolTip = 'Specifies the payment cap for this payment method.';
}
field(Plus; Rec.Plus)
{
ApplicationArea = All;
ToolTip = 'This field is used to demonstrate the use of Plus in a factbox.';
Editable = false;
}
field(Minus; Rec.Minus)
{
ApplicationArea = All;
ToolTip = 'This field is used to demonstrate the use of Minus in a factbox.';
Editable = false;
}
}
}
}
pageextension 50122 SalesOrderListExt extends "Sales Order"
{
layout
{
addbefore(Control1902018507)
{
part("Payment Methods"; "Payment Methods Factbox")
{
ApplicationArea = All;
Caption = 'Payment Methods';
}
}
}
}
page 50122 "Payment Methods Factbox"
{
Caption = 'Payment Methods';
LinksAllowed = false;
PageType = ListPart;
Editable = true;
SourceTable = "Payment Method";
layout
{
area(content)
{
repeater(Group)
{
field(Code; Rec.Code)
{
ApplicationArea = All;
ToolTip = 'Specifies the code of the payment method.';
trigger OnAssistEdit()
var
PaymentMethod: Record "Payment Method";
begin
PaymentMethod.Reset();
PaymentMethod.SetRange(Code, Rec.Code);
Page.Run(Page::"Payment Methods", PaymentMethod);
end;
}
field("Payment Cap"; Rec."Payment Cap")
{
ApplicationArea = All;
ToolTip = 'Specifies the payment cap for this payment method.';
}
field(Plus; Rec.Plus)
{
ApplicationArea = All;
ToolTip = 'This field is used to demonstrate the use of Plus in a factbox.';
trigger OnAssistEdit()
begin
Rec."Payment Cap" := Rec."Payment Cap" + 1000;
Rec.Modify();
end;
}
field(Minus; Rec.Minus)
{
ApplicationArea = All;
ToolTip = 'This field is used to demonstrate the use of Minus in a factbox.';
trigger OnAssistEdit()
begin
Rec."Payment Cap" := Rec."Payment Cap" - 1000;
Rec.Modify();
end;
}
}
}
}
}END
Hope this will help.
Thanks for reading.
ZHU




コメント