Triggering OnInsert of a Subform
mysamza
Member Posts: 66
I have extended an Item Table and Item Card Page with an Integer type field called Purchase Price.
I have to have this be shown on Subform of Sales Order. I added the field on the Subform after extending Sales Line table with the same field Purchase Price and have written the code;
Once at the subform I select this item, I want to just how Description and other fields get filled automatically; to get Purchase Price get populated as well. Right now only when the Purchase Price field is validated it brings in the value or else shows 0.
What trigger can I write the code in so that once an Item is selected by the user at Subform, just how other item related fields are filled automatically in one go, so does my Purchase Price?
I have to have this be shown on Subform of Sales Order. I added the field on the Subform after extending Sales Line table with the same field Purchase Price and have written the code;
trigger OnValidate()
var
ItemContainer: Record Item;
begin
IF ItemContainer.GET(Rec."No.") then BEGIN
"Purchase Price" := ItemContainer."Purchase Price";
ItemContainer.Modify();
END;
end;
Once at the subform I select this item, I want to just how Description and other fields get filled automatically; to get Purchase Price get populated as well. Right now only when the Purchase Price field is validated it brings in the value or else shows 0.
What trigger can I write the code in so that once an Item is selected by the user at Subform, just how other item related fields are filled automatically in one go, so does my Purchase Price?
0
Answers
-
1. Why "ItemContainer.Modify();"?
2. Sales Line column "No.".OnValidate trigger should do that job.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions