Wrong behavior OnModify?
Jambo
Member Posts: 12
Hi,
1) Create a table X with some fields.
Add this code to OnInsert trigger:
2) Create a form Y from table X.
So, let's examin the behavior when one want to insert, modify or delete a
record. If you run the table the behavior is as you have expected. But if
you run the form the behavior is in some way different:
After you have inserted a record with F3, OnInsert trigger fires, but after
that if you want to scroll up or down in the form the OnModify trigger fires
also. Why?
1) Create a table X with some fields.
Add this code to OnInsert trigger:
message('I am in OnInsert trigger')
Add this code to OnDelete trigger:
message('I am in OnDelete trigger')
Add this code to OnModify trigger:
message('I am in OnModify trigger')
2) Create a form Y from table X.
So, let's examin the behavior when one want to insert, modify or delete a
record. If you run the table the behavior is as you have expected. But if
you run the form the behavior is in some way different:
After you have inserted a record with F3, OnInsert trigger fires, but after
that if you want to scroll up or down in the form the OnModify trigger fires
also. Why?
0
Answers
-
Do you have more Information about your System?0
-
On a form, when you leave the last keyfield, Navision saves the data (=INSERT).
Then if you change something, when you leave the record, Navision saves the data again (=MODIFY);
To change the behaviour of the INSERT, put Form-property OnDelayedInsert to Yes.
This will ONLY save the record when you leave it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
@Kriki
I am changing nothing. I just scroll up or down after inserting some values, and I am getting the message "I am in OnModify trigger".Then if you change something, when you leave the record, Navision saves the data again (=MODIFY);
@rthsw
I am using Navision 3.70 with Cronus database. I have tested this behavior on card form and list form. Both with same result.0 -
-after inserting some values, you just scroll up or down sounds like that you are putting some value in some fields. When you leave the record, Navision saves it to the DB (=MODIFY). Or do I interpret your phrase wrongly? In this case, you need to write EXACTLY what you do, otherwise we can only guess.Jambo wrote:@Kriki
I am changing nothing. I just scroll up or down after inserting some values, and I am getting the message "I am in OnModify trigger".Then if you change something, when you leave the record, Navision saves the data again (=MODIFY);
-Are you sure you don't have any code in other places with the same message? You can find this by using the debugger.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
@Kriki
Ok. Let's go step to step.
First I press F3 to insert new record (no matter list or card form). I have two fields (No., Desc). I provide No. with some value and press enter. At this moment OnInsert trigger fires (as expected). Now I click into Desc field. Provide it with some values and press enter. Here comes the special moment: I want to see the other records, so I press the arrow keys or page up/down. At this moment OnModify trigger fires.
Just to say it again, I do not change or insert other values. And I have only the above mentioned code lines written in the table. Form C/AL code is empty.
My question is why OnModify trigger fires on this moment?0 -
I suppose you want the value you just entered in the description-field to be saved to your DB?Jambo wrote:Now I click into Desc field. Provide it with some values and press enter.
Navision needs to do a MODIFY (you just created the record with the INSERT before) to save the description-field into your record.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Kriki,
many thanks for clarification. I am now able to anticipate what will happen and why.0
Categories
- All Categories
- 73 General
- 73 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 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