how to get the no. series automaticaly from the code

nt
Member Posts: 160
Hi,
someone knows how to get the no. series automaticaly from the code?
for example if i got the the no. textbox hide, i got to get the no. from the code.
thanks.
someone knows how to get the no. series automaticaly from the code?
for example if i got the the no. textbox hide, i got to get the no. from the code.
thanks.
0
Comments
-
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)0 -
thanks.
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.0 -
But you have an OnInsert-trigger on the table, so write your code there and execute the OnInsert-trigger from the codeunit:
myTableVar.INSERT(TRUE);
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
where in the code i can get the last number used or the next nember for use...the number that i got to insert into the table for the next record?0
-
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)0
-
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?0
-
That is right, if you have some code in the OnInsert-trigger of the table, as shown above.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
OnRun() PurchHeader.INSERT(TRUE); PurchHeader."Buy-from Vendor No." := '01.000007'; PurchHeader.MODIFY;
in teh OnInsert() of the table:OnInsert() PurchSetup.GET; IF "No." = '' THEN BEGIN TestNoSeries; NoSeriesMgt.InitSeries(GetNoSeriesCode,xRec."No. Series","Posting Date","No.","No. Series"); END; InitRecord; IF GETFILTER("Buy-from Vendor No.") <> '' THEN IF GETRANGEMIN("Buy-from Vendor No.") = GETRANGEMAX("Buy-from Vendor No.") THEN VALIDATE("Buy-from Vendor No.",GETRANGEMIN("Buy-from Vendor No.")); "Doc. No. Occurrence" := ArchiveManagement.GetNextOccurrenceNo(DATABASE::"Purchase Header","Document Type","No."); DimMgt.InsertDocDim( DATABASE::"Purchase Header","Document Type","No.",0, "Shortcut Dimension 1 Code","Shortcut Dimension 2 Code"); IF WebSite.FIND('-') THEN SynchMgt.InsertPurchaseHeader(Rec);
This don´t work.0 -
This works:
OnRun() PurchHeader.INIT; PurchHeader."Document Type" := PurchHeader."Document Type"::Order; PurchHeader.INSERT(TRUE); PurchHeader."Buy-from Vendor No." := '01.000007'; PurchHeader.MODIFY;
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
it work.
thanks
i always got to define the type of document?0 -
Of course: how else can Navision know what Number Series you want to use (Quote, Order, Invoice).No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions