I added code that calculates the Inventory on Hand at a certain location to the Sales Line Factbox. It works as expected, but I would like the factbox to update once the user enters the Item No. in the Sales Order Subform. It currently only updates once the line is selected. How can I update the factbox from the subform's OnValidate trigger?
0
Answers
It's also why, in many versions of NAV Classic, the Sales Line FactBox (Item Information) is just a set of fields on the Subform itself, which already does get updated after the user selects an Item No.
CEO, Spare Brained Ideas, Göteborg, Sweden
New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"
Thank you for your help!
First, general info: The Sales Line Factbox is already linked on the base Sales Order with the ProviderID. If you design the Sales Order, and scroll way down to the FactBox Area, look at the properties of the Sales Line FactBox. It has "ProviderID" of 58 set. If you now go look at the properties of the Sales Line part (the subform), you'll see it has an ID of 58. Once you set a Provider ID on a FactBox, you can then use the SubPageLink to connect the two.
Now, for your situation. You've added a field to display some calculated values (in this case, Inventory for a specific location). A lot depends on where you're putting that code. I would say that you're on the right track if you have the code living on Page 9087 (Sales Line FactBox). All you should need to do now is add a call to your code in the OnAfterGetRecord() trigger on Page 9087. Any time the user changes the Sales Line, that code will get run.
CEO, Spare Brained Ideas, Göteborg, Sweden
New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"
If you test carefully, you could try, on SO Subform (46), tossing a "CurrPage.SAVERECORD" in the OnValidate of No. Then the OnAfterGetRecord is called as soon as you enter a "No.".
CEO, Spare Brained Ideas, Göteborg, Sweden
New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"
Try "Item Invoicing Factbox" as template instead.
It populate item information right after you enter item no.
Sr. Project Manager
S-Metric, LLC
jsung@smetric.com