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

Community site session details

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

how to handle event subscriber obsolete in BC26 and replaced by new event subscriber?

(0) ShareShare
ReportReport
Posted on by
We have business central V25 and not wanted migrate to V26.
 
OnBeforePurchaseLineVerifyChange event subscriber in "Whse. Validate Source Line" codeunit is obsolete in bC26 and instead we have to use Codeunit::"Purchases Warehouse Mgt.", 'OnBeforePurchaseLineVerifyChange',. How can we do it? 

The below code doesn't work and throwing error "The event 'OnBeforePurchaseLineVerifyChange' is not found in the target". My app.json is already set to application verion "26.0.0". 
 
Any idea what is wrong here?
 
#if not CLEAN26
//BC25 present logic
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse. Validate Source Line", 'OnBeforePurchaseLineVerifyChange', '', false, false)]
local procedure Codeunit5777_OnBeforePurchaseLineVerifyChange_Subscriber(var IsHandled: Boolean; var NewPurchLine: Record "Purchase Line"; var OldPurchLine: Record "Purchase Line")
var
begin
    IsHandled := true;
    // ...existing logic...
end;
#else
//BC26 and later
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Purchases Warehouse Mgt.", 'OnBeforePurchaseLineVerifyChange', '', false, false)]
local procedure PurchasesWarehouseMgt_OnBeforePurchaseLineVerifyChange_Subscriber(var PurchaseLine: Record "Purchase Line"; xPurchaseLine: Record "Purchase Line"; var IsHandled: Boolean)
begin
    IsHandled := true;
    // ...move your custom logic here
end;
#endif
 

 
I have the same question (0)
  • Suggested answer
    Sagar Dangar, MCP Profile Picture
    783 Super User 2025 Season 2 on at
    how to handle event subscriber obsolete in BC26 and replaced by new event subscriber?
    Hi,
     
    Please download version 26 symbols in your extension and then add new event subscriber
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,158 Super User 2025 Season 2 on at
    how to handle event subscriber obsolete in BC26 and replaced by new event subscriber?
    Ensure your app.json targets "application": "26.0.0.0", download symbols, and clean the cache if needed.
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,087 Super User 2025 Season 2 on at
    how to handle event subscriber obsolete in BC26 and replaced by new event subscriber?

    Maybe this will help you resolve it quickly.

     

    In Business Central 26, the OnBeforePurchaseLineVerifyChange event was moved from Codeunit 5777 (Whse. Validate Source Line) to Codeunit 1402 (Purchases Warehouse Mgt.). Your new subscriber is correct — but if you're getting an error like:

     
     

    "The event 'OnBeforePurchaseLineVerifyChange' is not found in the target"

     

    ✅ Here’s what to do:

     

    1.  

      Download the latest symbols

      Run this in VS Code terminal or Command Palette:

       
      AL: Download Symbols
      
       

      This ensures your environment references BC v26 and pulls in the new codeunits/events.


    2.  

      Ensure your app.json has the correct application version

       
      "application": "26.0.0.0"
      

    3.  

      Use this subscriber code for BC 26+

       
      [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purchases Warehouse Mgt.", 'OnBeforePurchaseLineVerifyChange', '', false, false)]
      local procedure PurchasesWarehouseMgt_OnBeforePurchaseLineVerifyChange_Subscriber(
          var PurchaseLine: Record "Purchase Line";
          xPurchaseLine: Record "Purchase Line";
          var IsHandled: Boolean)
      begin
          IsHandled := true;
          // your custom logic
      end;
      


    4.  
     

    After downloading the latest symbols, the error should be resolved.

     

    Mark below checkbox to make this answer Verified if it helps you.

  • Gerardo Rentería García Profile Picture
    23,574 Most Valuable Professional on at
    how to handle event subscriber obsolete in BC26 and replaced by new event subscriber?

    Hi, good day
    I hope this can help you, and give you some hints.

    Conditional Directives – CLEAN22 demystified – The BC Docs Librarian

    Best Regards
    Gerardo

  • Suggested answer
    YUN ZHU Profile Picture
    92,740 Super User 2025 Season 2 on at
    how to handle event subscriber obsolete in BC26 and replaced by new event subscriber?
    So you use BC26 symbol files to develop BC25 extensions?
    Although it is not recommended, if you don't want to upgrade, connect to the BC25 environment, re-download the symbol file, and only use the BC25 events.
     
    Hope this helps.
    Thanks.
    ZHU

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,308

#2
Sumit Singh Profile Picture

Sumit Singh 2,798

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,793

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans