web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

EventSubscriber Does not work - Onprem Environment

(0) ShareShare
ReportReport
Posted on by 292

HI,

I am trying to use an event subscriber functionality of 'Gen. Journal Line Table' on my On-Prem Business Central Environment ( v19). 

Code EX: 

 [EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", 'OnAfterSetupNewLine', '', true, true)]
    local procedure OnAfterSetupNewLine(var GenJournalLine: Record "Gen. Journal Line")
    begin
        Message('1 : Ok');
    end;
when i publish above code in a Code Unit ( as a extension) to my on-prem environment it does not trigger when i insert a new line to the Gen. Journal 
But,  when i publish same extension to cloud SandBox, it triggers when i insert a new line to the Gen. Journal,as i expect.
appreciate if you could help me to identify to root cause in on-prem environment for not triggering above event subscription.
Thanks,
Nishan
I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    If you are doing this the exact same way and you are on the exact same version with the exact same extensions installed there should really not be any difference.

    I would suggest your run the event recorder on your on-prem installation to figure out what events are really triggered.

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-events-discoverability

  • Verified answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at

    Hi, as Inge said, if you are tesing on the same version, it shouldn't be a problem. But, to rule out License and permission issues, can you try the following?

    Change true to false and try again.

    pastedimage1642982781702v1.png

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-subscribing-to-events#to-create-an-event-subscriber-method

    <SkipOnMissingLicense> Set to true to skip the event subscriber method call if the user's license doesn't cover the event subscriber codeunit. If false, an error is thrown and the code execution stops. false is the default. yes
    <SkipOnMissingPermission> Set to true to skip the event subscriber method call if the user doesn't have the correct permissions the event subscriber codeunit. If false, an error is thrown and the code execution stops. false is the default.

    Hope this will help.

    Thanks.

    ZHU

  • Suggested answer
    Greg Enns Profile Picture
    1,106 on at

    I would recommend checking the actual Publisher function name and parameters in the on-prem "Gen. Journal Line" table object. Any differences there from your Subscriber will cause your Subscriber to not work.

  • Nishan80 Profile Picture
    292 on at

    HI Zhu,

    Thank you for the reply.

    I tried changing the Flags to false . and now it shows the below error.

    "You do not have the following permissions on CodeUnit JI Test Code Unit: Execute. To view details about your permissions, see the Effective Permissions page. To report a problem, refer to the following server session ID: '342'."

    is this error related to license or permissions ?

    Thanks,

    Nishantha.

  • Suggested answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at

    Hi, Have you ever run the following command before Package or Publish? If it still doesn't work, I think it may be that the Object Range has not be assigned.

    pastedimage1643247903590v1.png

    Hope this will help.

    Thanks.

    ZHU

  • Nishan80 Profile Picture
    292 on at

    HI Zhu,

    I generated Permission set and republished the extension. but i still get the same error.

    is there anyway to check which object range is assigned to the Business central license ?

    Thanks,

  • Verified answer
    Marco Mels Profile Picture
    on at

    Hello,

    Looks like a license issue. Please raise a ticket to operations center via your partner / CSP (don't choose technical support as CSS / support does not generate / refresh licenses).

    Thanks.

  • Nishan80 Profile Picture
    292 on at
    [quote user="Nishan80"]

    HI,

    I am trying to use an event subscriber functionality of 'Gen. Journal Line Table' on my On-Prem Business Central Environment ( v19). 

    Code EX: 

     [EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", 'OnAfterSetupNewLine', '', true, true)]
        local procedure OnAfterSetupNewLine(var GenJournalLine: Record "Gen. Journal Line")
        begin
            Message('1 : Ok');
        end;
    when i publish above code in a Code Unit ( as a extension) to my on-prem environment it does not trigger when i insert a new line to the Gen. Journal 
    But,  when i publish same extension to cloud SandBox, it triggers when i insert a new line to the Gen. Journal,as i expect.
    appreciate if you could help me to identify to root cause in on-prem environment for not triggering above event subscription.
    Thanks,
    Nishan
    [/quote]

    Thank you all for your Guidance. Finally, Above issue got resolved after regenerating the license by our Partner, and then re-imported the new key to BC Instance. 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans