afterInsert trigger ?

Gette
Member Posts: 19
When I enter a new record via a form, I need to copy the record in another table in a specific format. I created the code and it worked with some test values.
The problem is that when I run the code in the onInsert trigger, the record isn't inserted yet and then I can not lookup values of the record.
Is there something like an afterInsert trigger or another way to do this ?
Thanks in advance,
Geert
The problem is that when I run the code in the onInsert trigger, the record isn't inserted yet and then I can not lookup values of the record.
Is there something like an afterInsert trigger or another way to do this ?
Thanks in advance,
Geert
0
Comments
-
When you are in OnInsert you have all values in Rec... what do you want to lookup? :?:0
-
I pass the ID of an employee record to a codeunit. This codeunit then uses the xmlport to extract an xml file.
The problem is when I 've added a new record, this new record is not yet in the employee table because I use the onInsert trigger.
If I use the rec, then I must create my xml file manually.
Any tips are welcome because I'm quit new in Navision and don't know what all the objects can do.
Kind regards,
Geert0 -
You can use the onModify trigger of the table to copy or update the record in the secondary table, each time you modify the record in your source form, the onModify trigger of the table will run and update the other table.
Another idea is to create a button in your form that will export the contents of any record in the table to the other table.Abraham0 -
Pass whole record into the codeunit instead ID only...0
-
This brutal hack simulates an onAfterInsert trigger.
OnInsert
Rec.INSERT;
//Do what you need to do after insert
Rec.DELETE; // Delete the Rec so navision can add it.
I would appreciate comments.
Cheers0 -
naso wrote:This brutal hack simulates an onAfterInsert trigger.
OnInsert
Rec.INSERT;
//Do what you need to do after insert
Rec.DELETE; // Delete the Rec so navision can add it.
I would appreciate comments.
Cheers
That is Brutal :P
Just used it in a similar situation I was having and it seems to work just fine. I'll keep testing to make sure it works correctly.
edit: also works for making an OnAfterModify trigger.
OnModify
Rec.MODIFY;
// OnAfterModify Code
Thanks naso!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