Problem usring GETLASTERRORTEXT
marcoseaver
Member Posts: 7
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:
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.
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.
0
Comments
-
marcoseaver wrote: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.
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.0 -
kine wrote:marcoseaver wrote: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.
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.
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.0 -
Than the question is, if the code in the example is really fired, when there is some error inside the XMLPort or the code is not executed because the error in the XMLPort will cancel the transaction and the processing...0
-
kine wrote:Than the question is, if the code in the example is really fired, when there is some error inside the XMLPort or the code is not executed because the error in the XMLPort will cancel the transaction and the processing...
Yeah, that's the problem #-o
Than how can I get the error message without terminate the transaction and the process? ](*,)0 -
without encapsulation into codeunit... I do not know about any other way around...0
-
kine wrote:without encapsulation into codeunit... I do not know about any other way around...
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.0 -
Hmmm... than try to ask Microsoft, seems that error handling in XMLPort is done in some different way. Which error you have?0
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
- 322 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
