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
Answers
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:
May I humbly suggest this book:
http://www.packtpub.com/programming-mic ... -2009/book
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?
Sorry.
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... :?