Inserting Sales Line - Poulete item desc, special price, etc

markcle
Member Posts: 65
Hi All
Creating my first extension. One of the functions is to add a line item for freight based on the ship method.
When I'm using the UI, I select line type "Item" and enter item No 'FLOC' (for example). when I tab out of that field it will lookup the item desc, , posting groups, customer special pricing.
this is my code:
It adds the item, but doesn't lookup the description, etc.
What do I need to do to make it behave like the UI?
Thanks
Mark
Creating my first extension. One of the functions is to add a line item for freight based on the ship method.
When I'm using the UI, I select line type "Item" and enter item No 'FLOC' (for example). when I tab out of that field it will lookup the item desc, , posting groups, customer special pricing.
this is my code:
SalesLine.Init; SalesLine."Document Type" := rec."Document Type"; SalesLine."Document No." := rec."No."; SalesLine.Type := SalesLine.Type::Item; SalesLine."No." := 'FLOC'; SalesLine.Quantity := 1; SalesLine.Insert()
It adds the item, but doesn't lookup the description, etc.
What do I need to do to make it behave like the UI?
Thanks
Mark
0
Best Answer
-
most likely the code to fetch the description and other fields is located in the OnValidate trigger of "No.".
Through the UI the OnValidate is always triggered, but in code you can avoid it so you can do everything yourself so you have to actually call it yourself.
Instead of SalesLine."No." := 'FLOC'; you should use SalesLine.Validate("No.", 'FLOC');5
Answers
-
most likely the code to fetch the description and other fields is located in the OnValidate trigger of "No.".
Through the UI the OnValidate is always triggered, but in code you can avoid it so you can do everything yourself so you have to actually call it yourself.
Instead of SalesLine."No." := 'FLOC'; you should use SalesLine.Validate("No.", 'FLOC');5 -
thanks. That did it0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions