AL icon indicating copy to clipboard operation
AL copied to clipboard

Enum as Event parameter crashes client

Open Avanti05 opened this issue 8 years ago • 4 comments

Apparently the client crashes, when you use an enum as parameter for an Event.

Any suggestions for a workaround?

Avanti05 avatar Aug 02 '18 09:08 Avanti05

Could you give an example of AL code to reproduce the problem?

StanislawStempin avatar Aug 03 '18 08:08 StanislawStempin

enum 50100 TestEnum
{
    value(1; FirstEnumValue)
    {
        Caption = 'First Enum Value';
    }
    value(2; SecondEnumValue)
    {
        Caption = 'Second Enum Value';
    }
}
codeunit 50100 TestEnum
{
    trigger OnRun()
    var
        FooEnum: Enum TestEnum;
    begin
        TestPublisher(FooEnum::FirstEnumValue);
    end;

    [IntegrationEvent(false, false)]
    local procedure TestPublisher(TestEnum: Enum TestEnum)
    begin
    end;

    [EventSubscriber(ObjectType::Codeunit, Codeunit::TestEnum, 'TestPublisher', '', true, true)]
    local procedure TestSubscriber(TestEnum: Enum TestEnum)
    begin
        If Confirm(format(TestEnum)) then;
    end;
}

Avanti05 avatar Aug 03 '18 10:08 Avanti05

Used format before publish and evaluate after subscribe as a workaround for now so not critical.

Avanti05 avatar Aug 03 '18 10:08 Avanti05

Is there any timeframe for when enums will be added as a valid type throughout the system. (It isn't recognized for use with flowfields for instance, and I've experienced other places where I get a similar error.)

And do you know if enums will be part of the October BC release?

Avanti05 avatar Aug 15 '18 07:08 Avanti05