#BCFridayTips is here for #msdyn365bc developers!
π‘ Did you know TestField can automatically add a Show [Record] button to the error dialog?
When TestField fails, Business Central can give users a direct action to open the record and fix the problem.
You do not need to build this with ErrorInfo. It is already built into the platform.
Business Central resolves the target page from the Card page whose SourceTable matches the failing recordβs table.
β
TestField(Field)
β
TestField(Field, Value)
Both show the action for tables with a single primary key, such as Customer.
But tables with compound primary keys, such as Sales Header, do not.
trigger OnAction()
var
Customer: Record Customer;
begin
Customer.FindFirst();
Customer.TestField("Name 2");
end;

Why this matters:
β
Users can jump straight to the record instead of searching for it manually.
β
You get a better error experience without writing extra code.
Reference: Microsoft Learn - TestField methods.

Share to help others β»οΈ and follow for more tips! π