Retrieve and insert record
jaro84
Member Posts: 17
Hi there!
Im new to Nav development and I hope that someone can help me here
I want to retrive a record from table 27(Item) where No. equals 1 and save it in a variable.
I have created a variable called SalesLine of type Record and subtype Item where I want to store the retrieved record.
Then I want to insert this record into Form 46(SalesOrderSubForm).
I want this to happen everytime a user creates a new Sales Order.
Hope someone can help me or give me a hint
Im new to Nav development and I hope that someone can help me here
I want to retrive a record from table 27(Item) where No. equals 1 and save it in a variable.
I have created a variable called SalesLine of type Record and subtype Item where I want to store the retrieved record.
Then I want to insert this record into Form 46(SalesOrderSubForm).
I want this to happen everytime a user creates a new Sales Order.
Hope someone can help me or give me a hint
0
Answers
-
If I understand your question correctly your business case is to create a new sales line with an item.
This does not work as you expect if I analyse your question correclty.
You should create a variable of the type Record and subtype Sales Line.
Then you can create code like this:SalesLine.INIT; SalesLine."Document No." := 'SOMENO'; SalesLine."Line No." := 10000; SalesLine.INSERT(TRUE); SalesLine.VALIDATE("Item No.", 'THEITEM'); SalesLine.MODIFY(TRUE);
May I humbly suggest this book:
http://www.packtpub.com/programming-mic ... -2009/book0 -
Thanks for your answer.
I've tried to your code example a couple of times, but I keep getting errors like:
The sales header does not exists.
Identification fields and values: Document Type='Quote',No.='SOMENO'
This is the code:
Form - OnBeforePutRecord()
SalesLine.INIT;
SalesLine."Document No." := '1';
SalesLine."No." := '1';
SalesLine.INSERT(TRUE);
SalesLine.VALIDATE("Item No.", 'THEITEM');
SalesLine.MODIFY(TRUE);
I want to insert item nr 1 into the sales line.
Of item nr 1 I only want to insert: No., Description, Base Unit of Measure and Unit Price
What is wrong?
0 -
There is a small typo in my code.
SalesLine.INIT; SalesLine."Document No." := '1'; SalesLine."Line No." := 10000; SalesLine.INSERT(TRUE); SalesLine.VALIDATE(Type, Type::Item); SalesLine.VALIDATE("No.", '1'); SalesLine.MODIFY(TRUE);
Sorry.0 -
jaro84 wrote:I've tried to your code example a couple of times, but I keep getting errors like:
The sales header does not exists.
Read through the basic NAV Functional (not development) introduction. You have to know how the application works before you can develop for it. That means you have to know what a header is and what a line is and how they relate to each other.0 -
matttrax wrote:
Read through the basic NAV Functional (not development) introduction. You have to know how the application works before you can develop for it. That means you have to know what a header is and what a line is and how they relate to each other.
Agree. Or some of the Packt books.
That does not justify my typo though... :?0 -
Thank you for your help and time
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

