I need some help on this one.
I need to find a trigger what gives me the 'Line No.' if I'm creating a new SalesLine, with form property: DelayedInsert = True.
The problem what I have is that Navision doesn't have the 'Line No.' available at the time that you create a new salesline with Delayed insert = true. The line will only be created if you go to the next line.
I need the lineNo field in order to create a Subline, attached to the salesline.
I tried triggers in the SalesLine form aswell. Just nothing works.
Please help.
Thanks,
Roelof de Jong.
0
Comments
Please check the AutoSplitKey on the form property. Make sure it's set to YES.
Also, make sure the Line No. is the last key on your primary key.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
- Sales Order Subform -- OnInsertRecord
- Sales Line Table -- OnInsert
If you add code to the form's OnInsertRecord trigger, be sure to EXIT(TRUE) if you want the usual insert behavior to continue. Otherwise, the form will assume that you have inserted the record on your own.You are awesome.
That did the trick. I wish we as Navision programmers could update our skills with tips and tricks like this. There are actually so many things we just don't know.
Thanks again!
Kind regards,
Roelof de Jong.
Yes, it really works. What happens is that, if you set DelayedInsert = true, Navision is not immediateley inserting a new record when you enter data on a line. If you add some code to the OnInsert trigger of the form with an Exit(true) it will immediately save the line when you fire some code in that trigger. So, I was able to insert my subline, based on the key: DocType,DocNo,LineNo,SubLine.
I hope this helps.