AL icon indicating copy to clipboard operation
AL copied to clipboard

EventSubscriber on the page action

Open zhaohowie opened this issue 8 years ago • 2 comments

Hi,

I have an EventSubscriber on th page 393, action35. After I converted to the AL, I got this, [EventSubscriber(ObjectType::Page, 393, 'OnBeforeActionEvent', 'Action35', false, false)]

Now, the VS Code is complaining "[AL] The action 'Action35' is not found in the target". The action35 name in the page is "<"Action35">" (no double quotes in the real code). I tried [EventSubscriber(ObjectType::Page, 393, 'OnBeforeActionEvent', "<"Action35">", false, false)], still got the same error.

Another question, Can I add an EventSubscriber on a pageextension action ?

I am using, Microsoft_System_13.0.12929.0.app Microsoft_Application_13.0.24266.0.app AL Language 2.0.41872

zhaohowie avatar Sep 07 '18 15:09 zhaohowie

Hello,

try this

_codeunit 50130 xxx { EventSubscriberInstance = StaticAutomatic;

[EventSubscriber(ObjectType::Page, Page::"Item Reclass. Journal", 'OnBeforeActionEvent', 'Post and &Print', false, false)] local procedure MyProcedure() begin

end; }_

Rather than specifying ID's use the real names of the objects/actions. Let me know if it helps

best regards, Thomas Barbut

thomasbarbut avatar Sep 08 '18 15:09 thomasbarbut

'Post and &Print' is working. Doesn't have to be the page name.

zhaohowie avatar Sep 10 '18 14:09 zhaohowie