I guess you want to know how to create an automatic numbering, based on a No. Series?
Have a look at the code of eg. the table 27 Item. You find code in the OnInsert-trigger:
IF "No." = '' THEN BEGIN
GetInvtSetup;
InvtSetup.TESTFIELD("Item Nos.");
NoSeriesMgt.InitSeries(InvtSetup."Item Nos.",xRec."No. Series",0D,"No.","No. Series");
END;
and the Validate-trigger of the field "No.":
IF "No." <> xRec."No." THEN BEGIN
GetInvtSetup;
NoSeriesMgt.TestManual(InvtSetup."Item Nos.");
"No. Series" := '';
END;
In the table Inventory Setup (variable InvtSetup), the field "Item Nos." is used to store the No. Series which need to be used for the automatic numbering of the items.
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
i want to insert a record to in a table from a codeunit, so i dont have de xRec variable, what i got to put instead?
and i dont have the OnInsert trigger.
This is already done in codeunit 396 NoSeriesManagement. The function InitSeries will call the function GetNextNo, which finds out the next number to be used.
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
so, in my codeunit i only have to run the OnInsert-trigger of the table and then put the value of the fields that i want, and then record.modify. right?
Comments
Have a look at the code of eg. the table 27 Item. You find code in the OnInsert-trigger:
and the Validate-trigger of the field "No.":
In the table Inventory Setup (variable InvtSetup), the field "Item Nos." is used to store the No. Series which need to be used for the automatic numbering of the items.
i want to insert a record to in a table from a codeunit, so i dont have de xRec variable, what i got to put instead?
and i dont have the OnInsert trigger.
in teh OnInsert() of the table:
This don´t work.
thanks
i always got to define the type of document?