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:
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]
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
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? :-s
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
Jorgito
What most often helps is either passing your record as a var parameter or calling CurrForm.UPDATE(FALSE) after your modal form returns...