How to intercept error message "IF Codeunt.run"
arcull
Member Posts: 191
Hi there. I wonder if it possible to get somehow the error string which terminates the running procedure in cases when you use
IF Codeunit.run(...in batch posting for instance. Thanks for your help.
0
Comments
-
-
Something like that would be nice, but is any such command avaialable on nav 4.0? Thanks again.Do you mean the GETLASTERRORTEXT function?0 -
U can write error message in that codeunit which u r running on OnRunTrigger of that codeunit.0
-
What about technical upgrade to NAV 5.0? Than you can use the new function as Mattrax wrote...0
-
Dear Kine
He wants to terminate the process.0 -
And? What do you want to tell by that? Have you read what he want? He want to catch the error message... :whistle:Mally wrote:Dear Kine
He wants to terminate the process.0 -
nope, that is not possible for now. But I thought of a soulution like this. First rewrite all errors like this, insted of usingWhat about technical upgrade to NAV 5.0? Than you can use the new function as Mattrax wrote...ERROR(Text013)
, I would writeErrString := Text013; ERROR(ErrString);
. Then write a function in CU to retrieve ErrString. And if the CU fails to run, I would call my new function. But that doesn't seem the best way
0 -
You cannot use it in this way directly - when you run the codeunit through CODEUNIT.RUN, you cannot call some specific function of the same instance of the codeunit. You will need to use Singleinstance CU. Do not forget that many things could happen in nested objects, through TESTFIELDS etc...0
-
well this is not true, you can do it without any single instance cu. All you need is to declare the CU you are running and make sure the variables are global in that CU. But still this is not the method I want to use.You cannot use it in this way directly - when you run the codeunit through CODEUNIT.RUN, you cannot call some specific function of the same instance of the codeunit. You will need to use Singleinstance CU. Do not forget that many things could happen in nested objects, through TESTFIELDS etc...OBJECT Codeunit 50001 Test Post { OBJECT-PROPERTIES { Date=24.02.10; Time=11:12:07; Modified=Yes; Version List=; } PROPERTIES { OnRun=BEGIN ErrStr := Text001; ERROR(ErrStr); END; } CODE { VAR Text001@1000000000 : TextConst 'ENU=This is the error message!'; ErrStr@1000000001 : Text[100]; ; PROCEDURE GetErrStr@1000000001() : Text[100]; BEGIN EXIT(ErrStr); END; BEGIN END. } } OBJECT Codeunit 50002 Test Msg. Interception { OBJECT-PROPERTIES { Date=24.02.10; Time=11:15:04; Modified=Yes; Version List=; } PROPERTIES { OnRun=BEGIN IF NOT TestPostCU.RUN THEN BEGIN ErrStr := TestPostCU.GetErrStr; MESSAGE(ErrStr); END; END; } CODE { VAR TestPostCU@1000000000 : Codeunit 50001; ErrStr@1000000001 : Text[100]; BEGIN END. } }0 -
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 323 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

