Creating an Charge item order line automatically

harm.poelen
Member Posts: 36
Hi There,
I 'm new at Navision programming (up to now only a lot of VB and such). I have a project in which I need to generate some Charge Item order entry line after a users has entered a item line. I have found that after entering a line for a Charge Item you will also need to create lines in the 'Item Charge Assignment (Sales)' table (5809).
My question is the following... does anybody have some code segements which is creating the order lines for Charge Items and then automatically links this created line to one or more order lines for Items.
I think that I will get it right eventually... but help is always appriciated.
I 'm new at Navision programming (up to now only a lot of VB and such). I have a project in which I need to generate some Charge Item order entry line after a users has entered a item line. I have found that after entering a line for a Charge Item you will also need to create lines in the 'Item Charge Assignment (Sales)' table (5809).
My question is the following... does anybody have some code segements which is creating the order lines for Charge Items and then automatically links this created line to one or more order lines for Items.
I think that I will get it right eventually... but help is always appriciated.
CANE Microsoft Solutions BV
Prins Hendrikplein 14
2518 JC DEN HAAG
The Netherlands
http://www.cane.nl
Prins Hendrikplein 14
2518 JC DEN HAAG
The Netherlands
http://www.cane.nl
0
Comments
-
You are right about the "Item Charge Assignment (Sales)" table, it splits the quantity of the Charge to the items of the Sales Order.
The best way to track what to do, is to activate the debugger, insert a charge item, follow the code and write down all that is done. In addition, you should see the "Item Charge Assignment" in the Line menu. That way you wont miss anything important.
Then you could use the OnValidate of the 'No." field in the Line Record and when the "Type" is "Item" you execute your code.0 -
If I may elaborate on that.... There's a few things that are very useful to know in Navision programming.
One is what Arhontis is saying, that if you want to automate a manual process in Navision and oyu want to make sure you cover everything, turn on the debugger while you do it manually and track what it is doing.
Another is you can make a recordvariable run its OnValidate code by validating the field instead of just setting it:// so you would do this: SalesLine.VALIDATE("No.",'MYNUMBER'); // instead of this: SalesLine."No." := 'MYNUMBER';
And finally, you can make a record variable run its OnInsert or OnModify code by sending TRUE into its parameter:SalesHeader.MODIFY(TRUE); SalesHeader.INSERT(TRUE);
The default is FALSE, and by not running the code in the OnInsert/OnModify triggers, you run the risk of missing important code. If you want to only run parts of that code, you'll have to recreate it of course.
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
- 322 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