I am currently using XMLport to import SO into Nav. Since the program will be called using Job Queue, I tried to avoid all the popup errors / message. I have tried the following code to call the XMLPort using a CodeUnit:
IF NOT XMLPORT.IMPORT(XMLPORT::"Import XML",g_insInStream) THEN BEGIN
//MESSAGE(GETLASTERRORTEXT);
ErrorLog(l_recQueue,g_txtCompanyName,g_txtSONo,GETLASTERRORTEXT);
END;
However, the GETLASTERRORTEXT method cannot get me the last error message if there occurs an error in the XMLPort.
I have also tried using one CodeUnit to call another CodeUnit. This time, it works.
Anybody can explain this and give me some help. Thx in advance.
Comments
It is because the command is only working with the codeunit "if codeunit.run then". But you can ask Microsoft if it was intended to work with XMLPort too and this is a bug, or it is by design.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks for your reply.
The GETLASTERRORTEXT command actually can capture the error message that has been popped up and not yet been cleared by CLEARLASTERROR command, no matter the error is raised by codeunit or xmlport or anything else.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Yeah, that's the problem #-o
Than how can I get the error message without terminate the transaction and the process? ](*,)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I tried to use another codeunit to call the codeunit which calls the XMLPort, and use the same IF codeunit THEN... code. But it cannot bypass the error window.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.