Validate sales line

kenl
Member Posts: 182
Hello,
I have a problem on validate sales line.
I need to avoid two sales lines having same Item and location code.
I add checking on Table SalesLine.OnInsert().
if condition Then
Error(Reason);
But when I run the form and hitting the condition, system will auto-close the form.
How do I do the checking?
I cann't put the checking on "No." and "Location Code" field level, since it would be too early to do checking.
Thanks.
I have a problem on validate sales line.
I need to avoid two sales lines having same Item and location code.
I add checking on Table SalesLine.OnInsert().
if condition Then
Error(Reason);
But when I run the form and hitting the condition, system will auto-close the form.
How do I do the checking?
I cann't put the checking on "No." and "Location Code" field level, since it would be too early to do checking.
Thanks.
0
Comments
-
Hi kenl,
I'm a novice in Navision, but I would do the following (on table level):
In the OnValidate event of No., I would firstly check if the Location Code has already been supplied for this record. If it has, I will check if any other line items exist with the same combination. If none exist, add the record, else ERROR();
In the OnValidate event of Location Code, I will check if the No. field has been filled. If it has, check for duplicates of this combination, same as above.
Hope this helps.
Cheers,
Charl0 -
Search this forum for "Mandatory field(s)"
You will find loads of information about how to create this.
However, bottom line is, Navision does not like mandatory fields.
Doing it the Navision way is easier. Check it in posting routines. Your users will get used to it.0 -
Hello charlp,
Thanks for your reply.
As I said before, set the checking at field validate would be too early.
Eg.
If the user create line, fill in the same "No.", but leave "Location Code" blank, then the checking will be skipped.
That 's why I need to put the checking at OnInsert().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