This blog shows to use error messages in different ways possible.
If you’re developing App for AppSource and want to give more detailed error message plus advanced capabilities to solve the error by end-users on their own.
Use Cases with examples:
1. ErrorInfo.Create (not a data type but as a direct function)-
When used with Error() do not make any difference and will show below error.
local procedure InitializeClientError()
var
InitializeErrorInfo: ErrorInfo;
ErrorTitleLbl: Label 'Initializing error.';
UpdateLbl: Label 'Make Update';
begin
InitializeErrorInfo.DataClassification(DataClassification::SystemMetadata);
InitializeErrorInfo.ErrorType(ErrorType::Client);
InitializeErrorInfo.Verbosity(Verbosity::Error);
InitializeErrorInfo.Message(InitialMsg);
InitializeErrorInfo.Title(ErrorTitleLbl);
InitializeErrorInfo.AddAction(UpdateLbl, Codeunit::"Update MNK", 'UpdateOnCustomer');
Error(InitializeErrorInfo);
end;
codeunit 50100 "Update MNK"
{
trigger OnRun()
begin
end;
procedure UpdateOnCustomer(ErrorInfo: ErrorInfo)
var
SomeProcessesLbl: Label 'Some process or data updates here.';
begin
Message(SomeProcessesLbl);
end;
}
Output:
6. ErrorInfo (with Navigation)-
Purpose: To show some error message with a navigation, action and title.
It was hard to insert item tracking lines for item journals as they are saved in different table. Plus going to each journal lines and then inserting a lot/serial is a huge manual task.
Before Enabling:
The user needs to click on Item Tracking Lines and then enter Lot/Serial for that item (which needs to be done for all items if list is huge):
Solution:
On journal batches, enable the setup as shown in below snapshot.
After Enabling:
Four fields (highlighted below) would be shown on Item Journals Line (you must have seen them in Item Reclassification Journals).
Entering the data or uploading the data here allows to create a Item Tracking Lines in background.
This helps in uploading opening inventories in easier manner for items with lots / serials.
Same feature is available on Warehouse physical journal. Give it a try!!
Microsoft Dynamics Business Central Wave 1, 2021 included item availability by lot after approximately 90 votes on this idea. We will go through the functionality introduced, how it was done, pros and cons of module.
What’s New:
How:
New buffer table ‘Availability Info. Buffer’, a matrix page and couple of queries to retrieve Lot from item ledgers and reservation entries.
Pros:
Easily lists serial/lot number of items to determine the expiration, inventory, availability, requirements on single page.
Cons or Suggestions:
Includes items with no item tracking codes on Item No filter (that can be considered).