Control addin event arguments

josalmjosalm Member Posts: 6


Hi,

According documentation the arguments in events within control addin must belong to an array.

I can't understand how should this work with arguments. Here's my code:

AL:
trigger PreviewDocument(DocId: Text)
begin
    Message('Trigger PreviewDocument Invoked');
end;

AL Control Addin:
event PreviewDocument(DocId: Text);

Js
script: (this is where the button is added inside a loop) In here, i
tried without the brackets, with them and with and without question
marks.
'<div id=buttonPreview>' +
'<button onclick="previewDocumentFunction(["' + Docid + '"])">Preview</button>' +
function previewDocumentFunction(DocId) {
    Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('PreviewDocument', [DocId]);
}
document.querySelector('buttonPreview').addEventListener('click', previewDocumentFunction);

After inspect the page:

2henpkdvf6z2.png

Nothing happens after the click.

Any ideas?
Sign In or Register to comment.