GETLASTERRORTEXT in NAV 4.0 SP3

andy76andy76 Member Posts: 616
edited 2008-09-04 in Navision Attain
Hello,

I used the function GETLASTERRORTEXT in version 5.0.

Now I should use the same function in a db ver 4.00 sp 3 but I don't have this function.

I need it to log if a codeunit goes wrong, returns false:


Following is the code running on 5.0

IF NOT CODEUNIT.RUN(CODEUNIT::"Item Jnl.-Post Batch",gRecItemJournalLine) THEN BEGIN
retValue := FALSE;
ErrorLogMgt.SetInterruptingSeverity := 0;
ErrorLogMgt.LogError(TaskCode,
TaskID,
'BATCH_ERROR',
COPYSTR(GETLASTERRORTEXT,1,250)
,(GETLASTERRORTEXT,251,500)
,0);
CLEARLASTERROR;
END


How can I have same functionality in 4.0 sp3?

Thank you

Comments

  • tinoruijstinoruijs Member Posts: 1,226
    You can't have the same functionality in NAV 4.0 sp3.
    GETLASTERRORTEXT is new in NAV 5.0.

    You can do a technical upgrade to NAV 5.0. Or a full upgrade, but take will take a lot more time.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • tinoruijstinoruijs Member Posts: 1,226
    You can't have the same functionality in NAV 4.0 sp3.
    GETLASTERRORTEXT is new in NAV 5.0.

    You can do a technical upgrade to NAV 5.0. Or a full upgrade, but take will take a lot more time.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • andy76andy76 Member Posts: 616
    I know that but there is not some workaround for my case.
    How did you do before NAV 5.0?
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    You coudn't. It simply did not exist.

    Sorry.
  • BeliasBelias Member Posts: 2,998
    OT but...
    andy76 wrote:
    COPYSTR(GETLASTERRORTEXT,1,250)
    ,(GETLASTERRORTEXT,251,500)
    you should write
    COPYSTR(GETLASTERRORTEXT,1,250) 
    ,(GETLASTERRORTEXT,251,250) 
    
    :mrgreen::mrgreen::mrgreen:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    Hi All

    ...but you can use an automation for imitation GetLastError function. For example NAV Timer - run some code on tick event and catch all errors on special event which return last error...
  • ajhvdbajhvdb Member Posts: 672
    You can catch errors in 4.0 by assuming a field or record goes wrong and write this in your logentry.

    if the codeunit runs ok, delete the logentry

    You can't catch the contents of the message.
  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    it's real but only under NAS...because error message will be reflected as well
    ...other automation http://mibuso.com/dlinfo.asp?FileID=886
Sign In or Register to comment.