I'm a fairly new Developer, who has been given the chance to code in Business Central.
I’ve encountered a problem with my code, which I'm hoping someone can assistance me with.
Code currently:
[EventSubscriber(ObjectType::Page, Page::/item tracking Summary/, 'OnAfterGetRecordEvent', '', true, true)]
local procedure OnAfterGetrecordEvent(var Rec: record /Entry Summary/);
begin
if (Rec./Expiration Date/ > 0D) and (Rec./Selected Quantity/ > 0) then
message('Expiration Date is overdue!!! ' + format(Rec./Expiration Date/) + ' for item lot ' + Rec./Lot No./);
end;
Page/Table involved currently:
Page: 6500 & 6510
Table: 336 & 338
Purpose of code:
On page Item Tracking Lines (6510/336), once you click Proces, and Mark, the system automatically picks a Lot Number for my items (6500/338), I need my code to, at that point alert the user, if the Expiration Date is shorter than a custom Enum value set on customer card, rather than OD.
Issue I’ve encountered:
I cannot figure out how to connect my Event or Local Procedure to the Customer Card page, Record “Entry Summary” doesn’t have any info in it, which I can use to fetch data from Customer Card.
Once I get to page 6510 Item Tracking Lines, table 336 Tracking specification, the table is empty, until I click Process, Mark and then OK to finish adding the Lot Nr. (This is taking me to page 6500/table 338)
Now table 336 gets populated and has Order number etc.
(( Can I somehow fetch this data before the process is done? In order to look up for my Enum value?))