OnInsertRecord() trigger in Form executing twice
                
                    ckndr47                
                
                    Member Posts: 100                
            
                        
            
                    I know its not a good practise to have code in the OnInsertRecord trigger of the form; but due to certain business logic i have no other choice.
Problem:
So here is my problem. I have main form, and a sub form. The subform is linked through SubFormId, SubFormLink property.
In the OnInsertRecord trigger of my subform i have some code; now what happens when i try to insert a new record i could see my trigger executing twice which results in abnormal behavior.
I have done a work around for that by playing with the boolean flags; which is actually stopping the trigger to execute 2nd time.
But what i am curious abt is why this trigger is getting fired twice, that has never happened before, its been years.
Somebody told me that its a problem with Navision Executable but still there has to be a workaround; becuz its totally abnormal and strange.
Need your expert opinion about that.
Thanks and Regards,
                Problem:
So here is my problem. I have main form, and a sub form. The subform is linked through SubFormId, SubFormLink property.
In the OnInsertRecord trigger of my subform i have some code; now what happens when i try to insert a new record i could see my trigger executing twice which results in abnormal behavior.
I have done a work around for that by playing with the boolean flags; which is actually stopping the trigger to execute 2nd time.
But what i am curious abt is why this trigger is getting fired twice, that has never happened before, its been years.
Somebody told me that its a problem with Navision Executable but still there has to be a workaround; becuz its totally abnormal and strange.
Need your expert opinion about that.
Thanks and Regards,
0                
            Comments
- 
            is there code on the table & form OnInsert?0
 - 
            Yeah there is some code in the OnInsert() trigger of table and OnInsertRecord() trigger of form.
But the triggers are executing twice; there is no other code in the form or table apart from that.0 - 
            There are 2 triggers than 1 in the table and 1 in the form. So the triggers will be run twice.0
 - 
            @Tazzy1972
hahahahah... good reply...
thanks man i didnt know abt that
 lol
I think u didnt read the post correctly
What i am saying my triggers are executing twice; so twice in form, twice in table. Cuz its a problem in Navision executable i know that, just wanted to confirm with you guys if u ever come across with a situation like that.0 - 
            Sometimes this can be because some CUrrForm.UPDATE or SAVERECORD in the code during saving the record. Than it start the insertion process one again... check that.0
 - 
            There is no such code like CurrForm.UPDATE or SAVERECORD
Its really very strange0 
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
 - 323 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
 
