Parhase Header Delete
Fommo
Member Posts: 138
Hi there
I have a mysterious (for me anyway) problem. I'm doing an integration with NAV from a external system. The external system sends messages to NAV for posting invoices and such things.
Everything works out fine, except for canceling invoices.
I use the following code:
When I step through "Purchase Header".OnDelete everything seems to go fine, but when I come back to the code in my example I get an error saying that the invoice was not found. And then the execution breaks.
The result is that the invoice is deleted as intentioned, but I can't send any verification to the external system as I can't execute the code below the deletion.
Does anyone know what is wrong, or am I just stupid? ](*,) [/code]
I have a mysterious (for me anyway) problem. I'm doing an integration with NAV from a external system. The external system sends messages to NAV for posting invoices and such things.
Everything works out fine, except for canceling invoices.
I use the following code:
IF (PurchHeader.GET(PurchHeader."Document Type"::Invoice, C00)) THEN BEGIN
// Delete the invoice
PurchHeader.DELETE(TRUE);
When I step through "Purchase Header".OnDelete everything seems to go fine, but when I come back to the code in my example I get an error saying that the invoice was not found. And then the execution breaks.
The result is that the invoice is deleted as intentioned, but I can't send any verification to the external system as I can't execute the code below the deletion.
Does anyone know what is wrong, or am I just stupid? ](*,) [/code]
0
Comments
-
Check with the debugger where the error occurs. Probably it is some trigger that does a get/find on the header that has just been deleted.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
kriki wrote:Check with the debugger where the error occurs. Probably it is some trigger that does a get/find on the header that has just been deleted.
Well, I've gone through the code with the debugger and the strange thing is that OnDelete is ending normally, it execute every line in it as it should, but then when I press F8 once more to go back to the call for PurchHeader.DELETE(TRUE) I get a "Break on error" message and the execution ends pointing on that very PurchHeader.DELETE(TRUE) line.
So I guess that something happens between the ending of OnDelete and the jump back to the call, something that I'm npt allowed to see and that triggers the error.
Do you have idea what it can be, since I can't trace it deeper down with my developer license? :-s0 -
I've seen that error when deleting a record in code on a form and that record is currently being displayed on the form. When the system finishes executing the code, it refreshes the screen and tries to read the record that was just deleted. Your post doesn't specify where your delete code is so I don't know if this is relevant.0
-
Hi all.
I have the same problem as described by Fommo and ssi.
From the General Journal form, I open a modal form that deletes one of the original Gen. Journal Lines and replaces it with new Lines. The above code is executed at the OnPush trigger of the OK button of the Modal Form.
When the modal form closes, I get an error that the (deleted) line does not exist. I close the error window and the new lines appear normally. Everything works fine, except for the error message that the (old and deleted) line does not exist.
How can I overcome this problem?
Thanks a lot
Jorgito0 -
We would need to see your code...
What most often helps is either passing your record as a var parameter or calling CurrForm.UPDATE(FALSE) after your modal form returns...0
Categories
- All Categories
- 75 General
- 75 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions