Skip to main content

MSDYN365BC - Event Recorder - How to Identify Event to subscribe for Extensions?

Hi Readers,


Thank you for all your question. In this article, we will discuss a question from Justin Arnold.
"How Do we identify Which Event to Subscribe to appropriately integrate our own logic?"

With Business Central Microsoft Released a Feature called Event Recorder which works in the same way as Permission Recorder in NAV?


In this article, we will see what Events are available when user try to Post the Sales Order and then identify which one to use to check mandatory fields before posting. Also, we will see what additionally we can do with Event Recorder.

Open Sales Order Window and create a new sales order which is ready to Post as shown below.



Now in a separate window, Open Business Central Client and using Tell Me feature to search for Event Recorder as shown below. Now when we are ready to click Start in Event Recorder Window and then Post Sales Order.



After posting of the Sales order, Stop the Event Recorder process.


Stopping the Event Recorder will specify how many Events were called during the action that you performed which is posting a Sales order. This window then will show all Events triggered during the process as shown below. Sort the window using field 1 call order. This will show events called during execution.



I think OnAferCheckMandatoryFields (Call Order 22), will be the event that will provide me the place where I can add my code. Let's check is that the right event after using one more cool feature with Event Recorder.

If you move toward Right of the Event Recorder Window, you will find a Field GETALSNIPPET, If you click on the event record Business Central will provide the snippet for the Event Subscriber which you can Copy and Paste in AL Window to subscribe.


Now we will see where this event is placed and what Microsoft is doing in the Procedure where this event is placed. Right Click on Object (Sales-Post) and select Go To Definition. This will open Codeunit 80 (Sales-Post.dal) where we can see all code.



As we can see Microsoft is calling all TestField to check all mandatory fields that are required before posting Sales order, so this is the right event that I want to subscribe for my custom TestField.

Event Recorder can be used for any process like validating a field and system will provide all available events during that process.

Hope you like the article and learn something new.

I hope Justin Arnold, I answered your question, if not please let me know.

Stay Connected and let me know your views as a comment to this article.

Regards,
Saurav Dhyani
www.sauravdhyani.com

Comments

  1. Hi @Naresh,
    Event Recorder only shows published Publishers. It will not show any subscribers.

    ReplyDelete

Post a Comment

Popular posts from this blog

VIEW SERVER STATE permission on SQL Server?

Hi all, Sometime While trying to Login into a database we face an error message as shown below. --------------------------- Microsoft Dynamics NAV Classic --------------------------- You cannot start Microsoft Dynamics NAV Classic because you do not have the VIEW SERVER STATE permission on SQL Server. Contact your system administrator. --------------------------- OK    ---------------------------

BC 21 and Higher - PowerShell Cmdlet (Replacement of Business Central Administration).

Hi Readers, As discussed in last article about deprecating of Business Central Administration, there are few common actions that we use in administration till Business Central 20. For our on-prem customers, we will still require doing activities. As Microsoft suggest we need to start using PowerShell cmdlet.    Let's see how to do those via PowerShell, or Administration Shell. I will be keep adding commands as you comment to this article.

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing -