When RunObject property of a page action is used, no events are raised
The following code does not work, because the events are never raised. This happens whens the Action in the page uses the RunObject property.
It works fine If I:
- Remove the RunObject property in the action
- Write REPORT.RUN(REPORT::"Create Fiscal Year"); in the OnAction Trigger
Can it be possible to raise the events, also when the RunObject property is used in the base code? Thanks!
codeunit 50101 PAG100_Suscription
{
[EventSubscriber(ObjectType::Page,100,'OnAfterActionEvent','&Create Year',false,false)]
local procedure PAG100_OnAfterActionEvent_CreateYear(var Rec: Record "Accounting Period");
begin
Message('PAG100_OnAfterActionEvent_CreateYear');
end;
[EventSubscriber(ObjectType::Page,100,'OnBeforeActionEvent','&Create Year',false,false)]
local procedure PAG100_OnBeforeActionEvent_CreateYear(var Rec: Record "Accounting Period");
begin
Message('PAG100_OnBeforeActionEvent_CreateYear');
end;
}
Hi @LauraNicolas , thank you for reporting this issue. When using a RunObject property, the event subscribers on OnAfterActionEvent should be called and we will work on fixing it. If you want to use the OnBeforeActionEvent, then you should use the trigger as you mentioned in the description of the issue as the OnBeforeActionEvent events won't be triggered by design.
Thanks @qutreson . Good to know that OnAfterActionEvent will be called. It's a surprise that the OnBeforeActionEvent won't.
If I want to write extensions only, I cannot change how the action is defined. So, I won't be able to use OnBeforeActionEvent , which is very limiting is some escenarios.
This is a call to reconsider it :)
If it is not possible to change that behaviour, should we then request to remove the RunObject and write code in OnAction case by case? Would you do it just as you create new events on code when people requests it?
Many thanks for your answer.
We have also added the OnBeforeActionEvent for the RunObject property on our backlog, but we don't have any time estimation for it yet since it will imply some bigger changes on the server-client protocol. We will update this thread in the future when we have more information about when it will be possible to subscribe to actions using the RunObject property.
Hi, any update on when the OnBeforeAction will be supported in combination with RunObject? Thanks
BC17 is giving me this: Event trigger 'OnBeforeActionEvent' cannot be used because the action 'P&ost' specifies the 'RunObject' property. This warning will become an error in a future release.AL(AL0617)
Hi there, any updates on this issue?
Hi there, any updates on this issue :)?
Hi, any update on this issue?