Hi,
Unsure is this is the correct forum to post dev questions. If not, please let me know and I will delete it.
I’m starting to look at developing custom extensions for my workplace.
I have a project where I need to play a sound when an error occurs in a 3rd party extension.
I’m able to create a controlAddIn and trigger the sound via Javascript by clicking on an navigation button using an action.
The problem I am facing is that I would like to trigger the sound after a certain event happens.
I subscribed to the correct event using the following code
codeunit 60102 "AudioFeedback"
{
[EventSubscriber(ObjectType::Codeunit, Codeunit::"CodeUnitName", 'ActualEvent', '', true, true)]
local procedure CallJavascript()
begin
Message('Running')
CurrPage.AudioFeedback.playAudio('positive');
end;
}
By moving my procedure into an Event, I no longer have access to the page variable called CurrPage.
I understand why this doesn’t work but I can’t seem to find a way around it.
Can I either pass the CurrPage object to my procedure or should my procedure dispatch a new event that is captured by my page and then executes the code.
My apologies if I’m not using the correct terms. I know many languages but AL is bran new to me.
Thank you in advance for any help.