Backup build on F4 trigger in sales order header

aquarious
Member Posts: 32
hi ,
I need some pointer and advice here. I would like to delete a sales order card , when i press F4 i want to build a trigger to save all the data in sales order header into another backup table before the sales order header data being deleted. The reason why i want to do this is to revise data that have been deleted. Is there anyone can help me in this problem? Thank you
I need some pointer and advice here. I would like to delete a sales order card , when i press F4 i want to build a trigger to save all the data in sales order header into another backup table before the sales order header data being deleted. The reason why i want to do this is to revise data that have been deleted. Is there anyone can help me in this problem? Thank you
0
Comments
-
OnDelete trigger on Sales table or on Form (if you want to backup only on deleting on this form). 8)0
-
There is a function to archive the sales order in standarde Navision that you could call from the OnDelete function. You'd have to create access to this form from the S&R menu though, but you can do this with available Navision functions.0
-
Hi kine,
I have block entire chunck of code in OnDelete and i create a new order in sales order header and then i press F4 to try to delete the sales order and my sales order that just created was deleted!! :shock:
i thought that if i block entire chunk of code in the OnDelete in sales header it will not allow me to delete the sales order header that i have created ???
please advice , thank you0 -
Hi denster,
The reason why i cant used the archived function is the user does not want to do so, else it would have save me a lot of efford to do so....please advice thank you.
0 -
aquarious wrote:Hi kine,
I have block entire chunck of code in OnDelete and i create a new order in sales order header and then i press F4 to try to delete the sales order and my sales order that just created was deleted!! :shock:
i thought that if i block entire chunk of code in the OnDelete in sales header it will not allow me to delete the sales order header that i have created ???
please advice , thank you
Yes, it was deleted, you must insert Error in this trigger, if you want to disallow deleting. If no code is in this trigger, record is deleted without any action (without deleting linked rows, dimensions etc.....!!!)
Second point where disallow user to delete something is trigger OnDeleteRecord on form - if you return false, nothing is deleted, if you return true, all is OK and record is deleted with calling OnDelete trigger and after that trigger, recor is deleted.
OnDelete trigger does not delete the record, it only do some additional actions. Record is deleted after this trigger if no error occured... 8)0 -
aquarious wrote:Hi denster,
The reason why i cant used the archived function is the user does not want to do so, else it would have save me a lot of efford to do so....please advice thank you.
If you block all the code in the OnDelete trigger, that means that you make the system not do anything, so there is nothing stopping the user from doing this. If you want to not allow deletion of sales orders, then you should program an error in that trigger and no user will ever be able to delete them anymore.
What I have against programming data operations on the form is that you'd have to program the same thing on every form that accesses the table. If you program it in the table, it will automatically happen each time you put the table on a new form.0 -
hi denster hi kine,
I manage to fix this problem, my solution in OnDelete of Sales Header and Sales Line table i add in transferfields and insert code into the backup salesheader and salesline table.
Thank you for advice again0
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