Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Compile Error when trying to implement a custom integration event

(0) ShareShare
ReportReport
Posted on by 75

Hello

I need to add some custom code to a standard page, now I would like to use events and not modify the original object.

I understand the basic process of creating a custom event, but when I try to "raise" the event in the page and add the line with the publisher I always get a compile error message. What did I do wrong?

Here is what I have until now:

I created a codeunit with the event publisher:

EventPublisher.PNG

I tried to add the event to the desired page (here I get the error)

CallEvent.PNG

And I created a subscriber function (which has no code yet)

EventSubscriber.PNG

Why I am not able to compile the line in the standard object where I try to raise the event?

Thanks for every suggestion/answer

Best Regards

Joshua

*This post is locked for comments

  • Joshua-Lehmann Profile Picture
    Joshua-Lehmann 75 on at
    RE: Compile Error when trying to implement a custom integration event

    Avinash B Thanks a lot, you were right, the case was the problem, in all the event things I did not saw the case thing ^^

    And all the others thanks for helping and suggesting putting the event in the same object where its raised, but why should you do that?

    You want as less customization in the standard object (in my case the page) so the merge process is as easy as possible, so why should I add also a local function (the publisher) instead of just the one line (the event raise)? Is there a special reason why you suggested that?

    Because in the Microsoft learning video and also here in the documentation, they also use a separate codeunit for the publisher/subscribers.

  • Verified answer
    Avinash B Profile Picture
    Avinash B 1,455 on at
    RE: Compile Error when trying to implement a custom integration event

    Hi,

    I could see that, the event is raised inside the Case block. And the Event you created is not returning any value, but Case statements expects the some value (in your case it is "Table ID") to check.

    So i feel this might be the issue.

    Note :

    When you want to create any Event, please create an Event inside the object in which you want customise and then raise the event at the point where you want to customise.

    Basically the Event you create will also a Local Function.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: Compile Error when trying to implement a custom integration event

    The Integration event must be raised by the object itself (page here).

  • Hannes Holst Profile Picture
    Hannes Holst 5,767 on at
    RE: Compile Error when trying to implement a custom integration event

    Hi,

    I think the Publisher-Event and the corresponding function-call (to execute the Publisher-event) must be in the same Object.

    I didn't had the situation before in which it was in different objects.

    If you wan to keep the object-structure, then you could solve the problem by creating a public function in the Publisher-Codeunit, e.g. "Execute_OnBeforeNavigateRecords".

    That new function would then call the actual Publisher-Event in the same codeunit.

    Not sure if you know it, each Action of a Page can be subscribed by using the Events "OnBeforeActionEvent" and "OnAfterActionEvent". When these Publisher are selected the property "EventPublisherElement" is added automatically. Using "EventPublisherElement" you are able to define which Action you want to "listen" to.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans