Default value for new field in a form

david.weeks
Member Posts: 96
Hello All
I have added a new field to the Sales Header Form (orders). This is ship-to territory. I want this to default to the value already selected in the territory field in the Customer card.
If required the user can then change this value by looking up the territory code (already done this).
What is the best approach for achieving this?
Thanks
I have added a new field to the Sales Header Form (orders). This is ship-to territory. I want this to default to the value already selected in the territory field in the Customer card.
If required the user can then change this value by looking up the territory code (already done this).
What is the best approach for achieving this?
Thanks
0
Comments
-
You can put piece of code in table Sales Order.OnInsert.
Something like:
Customer.RESET;
Customer.SETFILTER("No.","Sales Order".CustomerNo);
IF Customer.FIND('-') THEN
NewField := Customer.TerritoryField;0 -
Customer.RESET;
Customer.SETFILTER("No.","Sales Order".CustomerNo);
IF Customer.FIND('-') THEN
NewField := Customer.TerritoryField;
That will work once the record has been inserted to the DB
From a processing point of view I would recommend:
On Validate trigger of the "Sell-to Customer No." field look for the following statement:
GetCust("Sell-to Customer No.");
There is a whole section of code that deals with getting information from the customer card. All you would need to do is add the following line:
NewField := Customer.TerritoryField;
Job Sorted
The advantage to this is that yo are not repeating any GET functions AND if the customer is changed for whatever reason, then this would form part of the STANDARD replace customer routine .
DeanRemember: Keep it simple0 -
Dean Axon wrote:Customer.RESET;
Customer.SETFILTER("No.","Sales Order".CustomerNo);
IF Customer.FIND('-') THEN
NewField := Customer.TerritoryField;
That will work once the record has been inserted to the DB
From a processing point of view I would recommend:
On Validate trigger of the "Sell-to Customer No." field look for the following statement:
GetCust("Sell-to Customer No.");
There is a whole section of code that deals with getting information from the customer card. All you would need to do is add the following line:
NewField := Customer.TerritoryField;
Job Sorted
The advantage to this is that yo are not repeating any GET functions AND if the customer is changed for whatever reason, then this would form part of the STANDARD replace customer routine .
Dean
Or that.0 -
Thanks guys, this was a great help!0
-
david.weeks wrote:If required the user can then change this value by looking up the territory code (already done this).®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0
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