Skip Code Execution in OnValidate Trigger

eskay
Member Posts: 11
Hello,
I have a problem with the OnValidate Trigger in a table.
When I select a new Data Entry for exampe "No." in a table I execute some code in the OnValidate Trigger of the field
and insert some "option lines" in an related table.
Now I have a problem when the "No" Entry is terminated. From system the message "Do you want to overwrite data y/n"
is displayed. When I select "No" my "Validate Code" is always executed and I have some Option Data Lines in the table which
I only want to inser on the "Yes" option of the System Message.
Is it possible to "catch" the system Message "Overwrite Data y/n" and skip the validation code if I select No?
It is a little bit difficult to explain but I hope someone can figure it out.
Thx
Siggi
I have a problem with the OnValidate Trigger in a table.
When I select a new Data Entry for exampe "No." in a table I execute some code in the OnValidate Trigger of the field
and insert some "option lines" in an related table.
(OnVALIDATE)... IF XtAttributeLines_loc.FIND('-') THEN BEGIN REPEAT XtAttributeLines2_loc.INIT; XtAttributeLines2_loc.TRANSFERFIELDS(XtAttributeLines_loc); XtAttributeLines2_loc.Type := Type; XtAttributeLines2_loc."No." := "No."; XtAttributeLines2_loc."Item No." := "Item No."; IF NOT XtAttributeLines2_loc.INSERT THEN XtAttributeLines2_loc.MODIFY; UNTIL XtAttributeLines_loc.NEXT = 0; END;
Now I have a problem when the "No" Entry is terminated. From system the message "Do you want to overwrite data y/n"
is displayed. When I select "No" my "Validate Code" is always executed and I have some Option Data Lines in the table which
I only want to inser on the "Yes" option of the System Message.
Is it possible to "catch" the system Message "Overwrite Data y/n" and skip the validation code if I select No?
It is a little bit difficult to explain but I hope someone can figure it out.
Thx
Siggi
0
Comments
-
Do you receive an overwrite or rename message? Where do you receive it? On insert etc?Ufuk Asci
Pargesoft0 -
quickly looking perhaps it's the transferfields line.
you transfer the fields then under the line you are setting the type, item no, etc again?0 -
That is the problem when you are changing related tables in the OnValidate trigger. It is much better to do these changes in OnModify/OnInsert trigger instead.0
-
Thx..
the simpliest solution is always the last on the mind
Of course this way is much more useable.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