Options

Subscriber for Published Integration event - NAV 2016

rnjbngrnjbng Member Posts: 82
Hi Folks -



In NAV 2016 codeunit 22 Item Jnl-Post line there is a function OnAfterInsertItemLedgEntry(ItemLedgEntry,ItemJnlLine); This function is a publisher with event type Integration. Does anyone know where I can find the subscriber for this published event(in other words code for this event). I checked the Event subscription and could not find Codeunit 22. Microsoft has not done a good job about the repository for Publisher and Subscription.

Any help is highly appreciated.

Thanks

SB.

Comments

  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-02-23
    If you don't see a publisher in Event Subscriptions then nothing is subscribed to it.

    Sometimes it happens that if you change subscriber signature it is no longer subscribed to a publisher.

    Why MS did a wrong job on this one? Would you prefer to see a table all publishers, even unsubscribed to ones? That would be tens thoushands of entries; every table, every fields, every OnBefore/After Insert/Delete/Modify/Validate + publishers in the code?


    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    rnjbngrnjbng Member Posts: 82
    Thanks Slawek, was very helpful.
  • Options
    KowaKowa Member Posts: 918
    edited 2018-02-23
    A function with which you can find all subcribers to a particular publisher when you move about in the code lines is something that really is overdue. The new Object Manager Advanced Version 12 now includes publishers and subcribers in their "Where used" function, but MS should do their homework here as well.
    Kai Kowalewski
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    @kowa you can already see subscriptions in the code in Event Subscription virtual table.
    LOCAL PROCEDURE ShowEventSubscribers@1(PublObjType: ',Table,,Report,,Codeunit,XMLPort,,Page,Query';PublObjID: Integer);
    
    Object : Record 2000000001;
    EventSubscr : Record 2000000140;
    Subscribers : Text;
    
    WITH EventSubscr DO BEGIN
    
      CASE PublObjType OF 
        PublObjType::Table:     SETRANGE("Publisher Object Type", "Publisher Object Type"::Table); 
        PublObjType::Report:    SETRANGE("Publisher Object Type", "Publisher Object Type"::Report); 
        PublObjType ::Codeunit: SETRANGE("Publisher Object Type", "Publisher Object Type"::Codeunit); 
        PublObjType::XMLPort:   SETRANGE("Publisher Object Type", "Publisher Object Type"::XMLport); 
        PublObjType::Page:      SETRANGE("Publisher Object Type", "Publisher Object Type"::Page); 
        PublObjType::Query:     SETRANGE("Publisher Object Type", "Publisher Object Type"::Query); 
        ELSE
          ERROR('PublObjType unknown (%1)', PublObjType );
      END;
      
      SETRANGE("Publisher Object ID", PublObjID);
      Subscribers := STRSUBSTNO('Subscribed to %1 %2:\', PublObjType, PublObjID);  
    
      IF NOT FINDSET THEN 
        Subscribers += 'nothing'
      ELSE
      REPEAT
        Object.GET(Object.Type::Codeunit, '', "Subscriber Codeunit ID");
        Subscribers += STRSUBSTNO('Codeunit %1 %2: %3\',
          "Subscriber Codeunit ID", Object.Name, "Subscriber Function")
      UNTIL NEXT = 0;
      MESSAGE(Subscribers);
    END; 
    

    Or you're talking about Object Designer function, something like Go To Definition?
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    KowaKowa Member Posts: 918
    edited 2018-02-26
    Or you're talking about Object Designer function, something like Go To Definition?
    Exactly. Something to prevent you from searching through endless lists when yon only need the specific ones attached to the publisher you are currently looking at.

    Kai Kowalewski
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Kowa wrote: »
    Exactly. Something to prevent you from searching through endless lists when yon only need the specific ones attached to the publisher you are currently looking at.
    +1 on that one. Maybe some Connet request... Or whatever it is called now..

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    KowaKowa Member Posts: 918
    edited 2018-02-27
    +1 on that one. Maybe some Connet request... Or whatever it is called now..
    Connect was closed down, now it's called Collaborate
    http://aka.ms/Collaborate

    Kai Kowalewski
Sign In or Register to comment.