Error Catching in NAS

icobaniicobani Member Posts: 70
I m writing a nas service for entegration with other program. This service is create General Journal Line with any parameter. Outside program is fill a parameter table and call nas service with msmq. if nas service receive a any message in msmq process with ticket id and create jounal lines.

But I need catch error message in navision side and write parameter result table. For example currency code is not true , i want write a error message parameter result table. I was try write a function like bellow but it is not run. I think because my modify code is rolle back.

Also, I can use only for Custom ERROR message. I cannot use for default error message. for example


Currency Code 'USD_' does not exist.

How can I catch all navision error.

thanks.



IF ("Recurring Method" IN
["Recurring Method"::"B Balance","Recurring Method"::"RB Reversing Balance"]) AND
("Currency Code" <> '')
THEN BEGIN
//ISG001 16.12.2008 ICI BEGIN
//
SetWebError(STRSUBSTNO(
Text001,
FIELDCAPTION("Currency Code"),FIELDCAPTION("Recurring Method"),"Recurring Method"));
//ISG001 END
ERROR(
Text001,
FIELDCAPTION("Currency Code"),FIELDCAPTION("Recurring Method"),"Recurring Method");
END;



My functions
//set ticket id
SetWebTicketID(paramWebTicketID : Code[20])
WebTicketID:=paramWebTicketID;




//Write error message
SetWebError(ErrDesc : Text[250])
//ISG001 16.12.2008 ICI BEGIN
//
IF WebTicketID<>'' THEN BEGIN
"Business Process Order Header".RESET;
"Business Process Order Header".SETRANGE("Business Process Order Header".TicketID,WebTicketID);
IF "Business Process Order Header".FINDFIRST THEN BEGIN
"Business Process Order Header"."Error Desc.":=ErrDesc;
"Business Process Order Header".Result:="Business Process Order Header".Result::Error;
"Business Process Order Header".MODIFY;
END;
END;
//ISG001 END
Ibrahim COBANI | Dynamics-NAV Developer Team Manager
I m a Consult

E-Mail: ibrahim@imaconsult.com
My BLOG

Comments

  • ta5ta5 Member Posts: 1,164
    Have a look at this
    viewtopic.php?t=28178

    The basic approach should be described there. Don't hesitate to ask for details if you get stuck.
    Thomas
  • icobaniicobani Member Posts: 70
    Thanks ta5,
    my be I dont understand but this solution for like only "Yes We have a problem but I dont know what is problem". getlasterror function is great but we use 4.03.
    Ibrahim COBANI | Dynamics-NAV Developer Team Manager
    I m a Consult

    E-Mail: ibrahim@imaconsult.com
    My BLOG
  • jlandeenjlandeen Member Posts: 524
    Yeah I agree that the If Codeunit.run then getlasterror method works quite well in versions later then 5.0 and it's probably the simplest & easy to implement.

    But as you're on version 4.03 that doesn't help - can you upgrade the client version to 5.0 and leave the objects alone? I did this for a client and it was a very quick easy way for them to support this new functionality with their NAS integration layer without going through all of th pain of upgrading their objects.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • WaldoWaldo Member Posts: 3,412
    A way to do it in earlier versions is working with the timer-dll and with the error-event that comes with it... .
    Works like a charm!

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • ta5ta5 Member Posts: 1,164
    Waldo wrote:
    A way to do it in earlier versions is working with the timer-dll and with the error-event that comes with it... .
    Works like a charm!

    Yes, this is a very good workaround, we used it several times.
  • icobaniicobani Member Posts: 70
    Can u share a example ?
    Ibrahim COBANI | Dynamics-NAV Developer Team Manager
    I m a Consult

    E-Mail: ibrahim@imaconsult.com
    My BLOG
  • kinekine Member Posts: 12,562
    Just use the search... ;-)

    NTimer have two Events - OnTimer and OnError. What is started in OnTimer and ends with error, the OnError is called adn it have one parameter - ErrorText...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • WaldoWaldo Member Posts: 3,412

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
Sign In or Register to comment.