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 290

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
  • Nishan80 Profile Picture
    290 on at
    RE: EventSubscriber Does not work - Onprem Environment
    [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. 

  • Verified answer
    Marco Mels Profile Picture
    on at
    RE: EventSubscriber Does not work - Onprem Environment

    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
    290 on at
    RE: EventSubscriber Does not work - Onprem Environment

    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,

  • Suggested answer
    YUN ZHU Profile Picture
    85,629 Super User 2025 Season 1 on at
    RE: EventSubscriber Does not work - Onprem Environment

    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
    290 on at
    RE: EventSubscriber Does not work - Onprem Environment

    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
    Greg Enns Profile Picture
    1,102 on at
    RE: EventSubscriber Does not work - Onprem Environment

    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.

  • Verified answer
    YUN ZHU Profile Picture
    85,629 Super User 2025 Season 1 on at
    RE: EventSubscriber Does not work - Onprem Environment

    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
    Inge M. Bruvik Profile Picture
    1,029 Moderator on at
    RE: EventSubscriber Does not work - Onprem Environment

    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

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans