I set up a controlAddin and am able to interact with it using by adding an action that I added to the pageextension.
Basically, the controlAddin is a simple javascript code that plays a sound depending on the result of the action.
I would like to change the behavior in order to trigger the sound after an event from a 3rd party extension is propagated. So far, I've been unable to do so as I can't pass a "CurrPage" as a parameter since it's protected.
This is the code that I have but am a complete beginner in AL.
How can the codeunit have access to the controladdin in order to trigger the sound?
PAGEEXTENSION
pageextension 60101 "WmsAudioFeedbackPageExt" extends "DSHIP Package Worksheet"
{
layout
{
addLast(content)
{
usercontrol(WmsAudioFeedback; WmsAudioFeedback)
{
ApplicationArea = All;
}
}
}
actions
{
addlast(Navigation)
{
action("Play Positive Audio")
{
ApplicationArea = All;
Caption = 'Play Positive Audio';
trigger onAction()
begin
CurrPage.WmsAudioFeedback.playAudio('positive');
end;
}
action("Play Negative Audio")
{
ApplicationArea = All;
Caption = 'Play Negative Audio';
trigger onAction()
begin
CurrPage.WmsAudioFeedback.playAudio('negative');
end;
}
}
}
}
CODEUNIT
codeunit 60102 "WmsAudioFeedbackCodeUnit"
{
SingleInstance = true;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"DSHIP Event Publisher", 'OnAfterScan', '', true, true)]
local procedure OnAfterScan(scan: Text; docType: Option; docNo: Code[50]; lp: Code[50]; item: Code[50]);
begin
//CurrPage.WmsAudioFeedback.playAudio('positive'); ==> ????
end;
}