AL
AL copied to clipboard
Odd behavior MyCodeunit.RUN(MyRecord)
In case of: IF NOT MyCodeunit.RUN(MyParamsRecord) then .... performing my code stops, even does not try to reach MyCodeunit OnRun trigger.
In case of: MyCodeunit.RUN(MyParamsRecord); Everything works fine.
I will take a look at what we are emitting. Thanks for reporting!
It all looks fine to me. I've used the following code to reproduce. Please let me know if I am getting something wrong.
codeunit 50109 MyCodeunit
{
TableNo = Customer;
trigger OnRun();
begin
Message('Running codeunit 50109');
end;
}
codeunit 50110 FailingCodeunit
{
TableNo = Customer;
trigger OnRun();
var
e : XmlElement;
t : Text;
begin
Message('Running codeunit 50110');
t := e.Name;
Message('Unreachable');
end;
}
page 50101 MyPage
{
PageType = Card;
actions
{
area(processing)
{
action(RunCodeunit)
{
trigger OnAction();
var
r : Record Customer;
c : Codeunit MyCodeunit;
begin
if NOT c.Run(r) then
Message('Something went wrong')
else
Message('Ran');
end;
}
action(RunCodeunitStatic)
{
trigger OnAction();
var
r : Record Customer;
begin
if NOT Codeunit.Run(50109, r) then
Message('Something went wrong')
else
Message('Ran');
end;
}
action(RunFailingCodeunit)
{
trigger OnAction();
var
r : Record Customer;
c : Codeunit FailingCodeunit;
begin
if NOT c.Run(r) then
Message('Something went wrong')
else
Message('Ran');
end;
}
action(RunFailingCodeunitStatic)
{
trigger OnAction();
var
r : Record Customer;
begin
if NOT Codeunit.Run(50110, r) then
Message('Something went wrong')
else
Message('Ran');
end;
}
}
}
}