Automatic deletion in NAV 2016
navuser1
Member Posts: 1,334
Dear Sir,
In a new Production Environment, the (only) Sales Lines get deleted automatically.
We can not find the reason. Any body have any idea regarding this kind of activity in NAV 2016 System.
Kindly inform.
Regards,
navuser1
In a new Production Environment, the (only) Sales Lines get deleted automatically.
We can not find the reason. Any body have any idea regarding this kind of activity in NAV 2016 System.
Kindly inform.
Regards,
navuser1
Now or Never
0
Answers
-
Are you sure it gets deleted, or is it just hidden in the background?"Money is likewise the greatest chance and the greatest scourge of mankind."0
-
At what time it's getting deleted??
OR you have no clues?Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
Thanks for your replies....

Record gets deleted from the table. I have checked & it's 100% correct.
Currently, I have no clues when it's happened.
I have investigated the SQL for the data deletion issue and come to know that the Sale Lines (Document Type =Order) are get deleted thru any kind of Transaction and the responsible user is NETWORK SERVICE (As all end users are logging into the NAV database using NavUserPassword Credential, so I can not the mark the right NAV User)
For the time being I have written a SQL trigger to prevent the data deletion from the Sales Line (Document Type =Order) table.ALTER TRIGGER [dbo].[Preventdeletion] ON [dbo].[CompanyName$Sales Line] FOR DELETE AS BEGIN DECLARE @Count int DECLARE @DocType int SET @Count = @@ROWCOUNT; IF EXISTS (Select 1 from deleted WHERE deleted.[Document Type]=1) BEGIN -- IF @Count >= (SELECT rowcnt FROM sysindexes WHERE ID = OBJECT_ID('[dbo].[CompanyName$Sales Line]')) BEGIN RAISERROR('Cannot delete all rows',16,1) ROLLBACK TRANSACTION RETURN; END -- END END; GO
[ Note : - The Client is using the Sales Order Screen to post Shipment Entry Only. They never post any kind of Invoice from the Sales Order Screen.]Now or Never0 -
You could use an Event Subscription to Subscribe to any Delete on that table? You could then just log the current call stack and/or details on the current User ID etc. You could log this in a table, file or send an email.1
-
Strange...
Try enable NAV log also and maybe put some debugger enabled ondelete() trigger of NAV0 -
Today, I got a strange error message(SQL trigger's error) during posting a Sales Invoice, and I'm shocked.Now or Never0
-
partially shipment is there.Now or Never0
-
I have checked & compare the code between the two text objects files (Codeunit 80), found no such kind of things.Now or Never0
-
Hi nick_robbo,
Thanks for your reply.
Still found no proper solution...
I know that the writing a sql trigger couldn't solve my problem. But it helps to prevent the data lose.
I have found (strange) some clue, which may help others to identify the main/one of the main reason for this issue.
1. The sql error message comes when I'm trying to delete the the first "Blank" Line from the Sales Invoice, where Invoice Lines are made by "Get Shipment Lines" function.
## But the Strange matter is that it is not happening for all the cases.
2. The Second called of function named"DeleteSalesLines" in the "OnDelete()" Trigger of the Sales Header (ID 36) Table finds the Sales Line records with Document Type =Order.
## Code of "DeleteSalesLines" is the BASE code of NAV
My investigation is still going on. As per your suggestion, will "Event Subscription" helps me to prevent the data lose with my sql trigger?
Suppose there is any fault C/AL code (SalesLine.DELETE OR SalesLine.DELETEALL without having any trigger call) is executed in NAV, will "Event Subscription" prevent the data from deletion ?
Kindly reply.Now or Never0 -
If you export all the objects as text, you can search for SalesLine.DELETE . You should also search for something like "Record 37" to find all variables for that table, since some variables are called SalesLine, some SalesLine2, etc.Alastair Farrugia0
-
Yes, this is the only pending work which I have to do...
Now or Never0 -
you can also use a tool such as GDTWhereUsed, load you nav .txt file, and then see where all the calls to rec 36 are made..1
-
Could be a customer that uses a RecordRef improperly set up?* Daniele Rebussi * | * Rebu NAV Diary *1
-
Could it be that a routine that was supposed to use a "temporary record" actually uses a real record of Sales Line table?1
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
- 328 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



