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...
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...
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.
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.
}
}
Comments
My Blog - nav.education
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
He wants to terminate the process.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.