NAV 2018 - List of Events?

OldNavDogOldNavDog Posts: 87Member
When MS first came out with "Events" in NAV 2016, they published a nice, categorized List of the Events currently defined in NAV.

However, even though there are a LOT more Events in NAV 2017 and even more in 2018 (and even a couple more in 2018 CU1), it doesn't seem like that list has ever been updated for NAV 2017 or NAV 2018 (or whatever it is called today... Tenerife?)

Alternatively, is there some way to get NAV to disgorge a List of Events?

Thanks!
Experience is what you get, when you don't get what you want. --Anon.

Answers

  • Slawek_GuzekSlawek_Guzek Posts: 1,564Member
    I am not aware of any 'hacks' to make NAV to reveal all the publishers. But tasked with preparing a list of those I'd dump all the 2018 objects into a text file and extract the publisher information from function decorators... It's a bit primitive method and requires some manual work but it works.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • OldNavDogOldNavDog Posts: 87Member
    I found a blog posting with a Powershell script to do just that.

    BUT, it doesn't tell you the list of AVAILABLE Events (like the Intrinsic ones for Pages, Codeunits, Tables, etc.). That ONLY seems to be available from the Drop-Down list when you go to define a particular Subscriber Function.

    But of course, there is NO WAY to copy/paste the contents of that drop-down (other than to do a screenshot and use OCR...)

    Which of course means that NAV has the way to generate that List SOMEWHERE in its bowels...

    Why does MS ALWAYS have to make things SO frickin' HARD?

    I haven't checked out VS Code, though. I wonder if it has a pick-list that is a little more, er "friendly"...?
    Experience is what you get, when you don't get what you want. --Anon.
  • Slawek_GuzekSlawek_Guzek Posts: 1,564Member
    I can't imagine someone trying to define subscriber on every single object, making a screenshot and then OCRing it or simply re-typing it into a list. It would be a torture - at least for me.

    After all, it would be probably quicker to extract the publisher functions from the code, and then generate build-in publishes. This would fairly quick and easy to do for tables. Pages would be more problematic as you would have to parse the metadata, either retrieved from NAV, or from pages definition dumped to some text file.

    Out of curiosity - where did you find build-in publishers for codeunits? I don't have 2018 installed, but quickly checked in 2017 and couldn't find any?

    I agree that MS could have easily added a bit more features to make NAV more developers-friendly. In my view it all goes in a rather opposite direction. Dunno, perhaps when I try NAV coding in VS I might change my opinion, but I've seen a few demos and webinars and unfortunately I don't share the enthusiasm of presenters.

    However on that one, a list of ALL publishers, I kinda understand why it is not available anywhere. Personally can't see any value added if it were available through a virtual table. It would be useful if you could plug-in the debugger into a publisher without having a subscriber attached to it

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • greatscott001greatscott001 Posts: 29Member
    I found this a while back and I don't remember from whom it was. I think it was Waldo but it might have been Brummel or Mohana.
    $DistriText = [System.IO.File]::OpenText("<all objects text file>")
    
    $ResultArray = @()
    $CurrentObject = ''
    $i = 0
    
    for(;;) {
        $TextLine = $DistriText.ReadLine()
        
        if ($TextLine -eq $null) { break }
    
        $i++
    
        switch ($true)
        {
            {$Textline.Contains("OBJECT ")} {$CurrentObject = $TextLine.TrimStart()}
            {$Textline.Contains("  [Integration")} {$CurrentEventType = $TextLine.TrimStart()}
            {$Textline.Contains("  [Business")} {$CurrentEventType = $TextLine.TrimStart()}
            
            {$Textline.Contains(" PROCEDURE") -and !([String]::IsNullOrEmpty($CurrentEventType))} {
                $CurrentFunction = $TextLine.TrimStart()
    
                $MyObject = New-Object System.Object
                $MyObject | Add-Member -MemberType NoteProperty -Name Object -Value $CurrentObject
                $MyObject | Add-Member -MemberType NoteProperty -Name EventType -Value $CurrentEventType
                $MyObject | Add-Member -MemberType NoteProperty -Name Function -Value $CurrentFunction            
                $ResultArray += $MyObject
    
                $CurrentEventType = ''
            }             
    
            Default {}
        }
    
        Write-Progress -Activity "Reading through objects.." -Status $CurrentObject
    
    }
    
    $DistriText.Close()
    $DistriText.Dispose()
    
    $ResultArray | ogv
    
Sign In or Register to comment.