I created a new report that calls a posting report. However, it doesn't work. It just keeps looping and I have to cancel NAV using task manager.
Here is the code I tried...
Sales Header - OnAfterGetRecord()
SalesHdr.SETCURRENTKEY("No.");
If (SalesHdr."Order Category" = 'Phone') and (SalesHdr."Package Exists" = True) Then
SalesHdr.SetFilter("Order Category",'Phone');
SalesHdr.SetFilter("Package Exists", 'Yes');
Report50056.SETTABLEVIEW(SalesHdr);
Report50056.RUN
It opens a blank sales header filter window, I select preview. It opens the posting window with just the Package Exists field filled in with "Yes". I still need to fill in Order Category, the goal is for it to autofill like the Package exists field does. Then when I select post, it just keeps repeating the posting window and I have to end task to get it to stop.
NAV 2015 - report 50056 is a copy of 297. No changes to it at this time.
Help!
0
Comments
You'll need to set SalesHdr.Filtergroup(2) and then pass it to the report for the filters to get through. At the end don't forget to reset the filtergoup (SalesHdr.Filtegroup(0)).
Check this for more info: https://docs.microsoft.com/en-us/dynamics-nav/filtergroup-function--record-