Error Handling

DevDev Member Posts: 74
hi all
how error handling can be done in nav 2009 using CLEARLASTERROR; and GETLASTERRORTEXT; i have write this code on report but control didnt get into next step as the error line is executed..
any help or sugeestion to use this error handling

Counter := Counter + 1;
IF Counter = 10 THEN BEGIN
ERROR('....Its an error...');
TextError := GETLASTERRORTEXT;
CLEARLASTERROR;

END;

Comments

  • ara3nara3n Member Posts: 9,256
    you need to wrap your code within a codeunit and then call the CU.
    CLEARLASTERROR;
    If Codeunit.run(your codeunitno) then
      message('success')
    else
      Message(GETLASTTEXTERROR);
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.