{"id":40758,"date":"2022-04-28T09:15:50","date_gmt":"2022-04-28T08:15:50","guid":{"rendered":"https:\/\/arquiconsult.com\/?p=40758"},"modified":"2024-10-23T13:49:37","modified_gmt":"2024-10-23T12:49:37","slug":"discoverability-of-events","status":"publish","type":"post","link":"https:\/\/arquiconsult.com\/es\/discoverability-of-events\/","title":{"rendered":"#019 DISCOVERABILITY OF EVENTS"},"content":{"rendered":"<div class=\"services_vertical horizontal_services row\" style=\"background-color: #f7f7f7; padding: 25px; border-radius: 5px; text-align: justify;\">\n<p>Every developer working with AL, probably, have been in a situation where there was the need to use an event. One of the main challenges of interacting with Microsoft D365 Business Central standard code if finding the event where the customization should fit. These events are often hard to find when coding, and there are basically two ways of finding an event:<\/p>\n<ol>\n<li>Open the standard object definition and go throughout the code searching for the event;<\/li>\n<li>Using the Web Client Event Recorder functionality.<\/li>\n<\/ol>\n<p>In this ArquiTips we will show how to use the Event Recorder. In this case, the purpose of the Event Recorder usage is to find the events triggered when posting a Sales Invoice.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<ol>\n<li><strong>Open Business Central Web Client and search for Event Recorder<\/strong><\/li>\n<\/ol>\n<p><img loading=\"lazy\" class=\" wp-image-40760 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Business-Central-Web-Client-and-search-for-Event-Recorder-640x302.png\" alt=\"Open Business Central Web Client and search for Event Recorder\" width=\"731\" height=\"345\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Business-Central-Web-Client-and-search-for-Event-Recorder-640x302.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Business-Central-Web-Client-and-search-for-Event-Recorder-768x363.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Business-Central-Web-Client-and-search-for-Event-Recorder-1536x726.png 1536w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Business-Central-Web-Client-and-search-for-Event-Recorder.png 1916w\" sizes=\"(max-width: 731px) 100vw, 731px\" title=\"-\"><\/p>\n<ol start=\"2\">\n<li><strong> Open Event Recorder in a new page<\/strong><\/li>\n<\/ol>\n<p>This step is essential, otherwise the Event Recorder will not record any event.<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-40763 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Event-Recorder-in-a-new-page-640x303.png\" alt=\"Open Event Recorder in a new page\" width=\"731\" height=\"346\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Event-Recorder-in-a-new-page-640x303.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Event-Recorder-in-a-new-page-768x364.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Event-Recorder-in-a-new-page-1536x727.png 1536w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Open-Event-Recorder-in-a-new-page.png 1914w\" sizes=\"(max-width: 731px) 100vw, 731px\" title=\"-\"><\/p>\n<ol start=\"3\">\n<li><strong> Start recording the events<\/strong><\/li>\n<\/ol>\n<p>Press action Start, in the Record Events action group, and do not close the Event Recorder page.<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-40766 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Start-recording-the-events-640x259.png\" alt=\"Start recording the events\" width=\"652\" height=\"264\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Start-recording-the-events-640x259.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Start-recording-the-events-768x310.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Start-recording-the-events.png 1104w\" sizes=\"(max-width: 652px) 100vw, 652px\" title=\"-\"><\/p>\n<ol start=\"4\">\n<li><strong> Post the Sales Invoice and stop the Event Recorder<\/strong><\/li>\n<\/ol>\n<p>After posting the Sales Invoice, go back to the Event Recorder page and press the Stop action in the Record Events action group. A message with the number of recorded events should be shown.<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-40771 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Post-the-Sales-Invoice-and-stop-the-Event-Recorder.png\" alt=\"Post the Sales Invoice and stop the Event Recorder\" width=\"647\" height=\"356\" title=\"-\"><\/p>\n<ol start=\"5\">\n<li><strong> View the recorded events<\/strong><\/li>\n<\/ol>\n<p>A list with the recorded events should be presented. Since that are a lot of events that happened in the posting but are not related to posting, we can filter the list so show us, for instance, just the events that occur in the posting Codeunit.<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-40772 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/View-the-recorded-events-640x269.png\" alt=\"View the recorded events\" width=\"726\" height=\"305\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/View-the-recorded-events-640x269.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/View-the-recorded-events-768x323.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/View-the-recorded-events-1536x646.png 1536w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/View-the-recorded-events.png 1918w\" sizes=\"(max-width: 726px) 100vw, 726px\" title=\"-\"><\/p>\n<ol start=\"6\">\n<li><strong> Subscribe the event <\/strong><\/li>\n<\/ol>\n<p>Having found the event to subscribe, the next step is to subscribe the event in AL. In Event Recorder, next to the Calling Method column, there is a Get AL Snippet action that will return a message with the Event Subscriber definition. Just copy the message content and paste it in your AL project.<\/p>\n<p><img loading=\"lazy\" class=\"size-medium wp-image-40775 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Subscribe-the-event-640x296.png\" alt=\"Subscribe the event\" width=\"640\" height=\"296\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Subscribe-the-event-640x296.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Subscribe-the-event.png 671w\" sizes=\"(max-width: 640px) 100vw, 640px\" title=\"-\"><\/p>\n<p>Another way to subscribe to the event is to use the command AL: Find Event (Alt+Shift+E) in VS Code. Just type the name of the event to subscribe the event is automatically brought to our Codeunit.<\/p>\n<p><img loading=\"lazy\" class=\" wp-image-40778 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Another-way-to-subscribe-to-the-event-is-to-use-the-command-AL-640x187.png\" alt=\"Another way to subscribe to the event is to use the command AL\" width=\"759\" height=\"222\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Another-way-to-subscribe-to-the-event-is-to-use-the-command-AL-640x187.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Another-way-to-subscribe-to-the-event-is-to-use-the-command-AL-768x224.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Another-way-to-subscribe-to-the-event-is-to-use-the-command-AL-1536x448.png 1536w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2022\/04\/Another-way-to-subscribe-to-the-event-is-to-use-the-command-AL.png 1909w\" sizes=\"(max-width: 759px) 100vw, 759px\" title=\"-\"><\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-40758\" data-postid=\"40758\" class=\"themify_builder_content themify_builder_content-40758 themify_builder tf_clear\">\n    \t<!-- module_row -->\n\t<div  data-lazy=\"1\" class=\"module_row themify_builder_row tb_nus1581 tb_first tf_clearfix\">\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_cai8581 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module text -->\n<div  class=\"module module-text tb_9tkr581 arquitps-data  \" data-lazy=\"1\">\n        <div  class=\"tb_text_wrap\">\n    <p><script>\njQuery(\".tbp_post_month:contains(Janeiro)\").html(\"January\");\n\njQuery(\".tbp_post_month:contains(Fevereiro)\").html(\"February\");\n\n\njQuery(\".tbp_post_month:contains(Mar\u00e7o)\").html(\"March\");\n\n\njQuery(\".tbp_post_month:contains(Abril)\").html(\"April\");\n\n\njQuery(\".tbp_post_month:contains(Maio)\").html(\"May\");\n\n\njQuery(\".tbp_post_month:contains(Junho)\").html(\"June\");\n\n\njQuery(\".tbp_post_month:contains(Julho)\").html(\"July\");\n\njQuery(\".tbp_post_month:contains(Agosto)\").html(\"August\");\n\njQuery(\".tbp_post_month:contains(Setembro)\").html(\"September\");\n\njQuery(\".tbp_post_month:contains(Outubro)\").html(\"October\");\n\njQuery(\".tbp_post_month:contains(Novembro)\").html(\"November\");\n\njQuery(\".tbp_post_month:contains(Dezembro)\").html(\"December\");\t\n\n\n\n<\/script><\/p>    <\/div>\n<\/div>\n<!-- \/module text -->\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t\t<!-- module_row -->\n\t<div  data-anchor=\"sucesso\" data-hide-anchor=\"1\" data-lazy=\"1\" class=\"module_row themify_builder_row sucesso repeat tb_has_section tb_section-sucesso tb_8prv218 tf_clearfix\" >\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_kmtj218 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module buttons -->\n<div  class=\"module module-buttons tb_wmqc218 buttons-horizontal transparent popmake-24705 large circle tf_textc\" data-lazy=\"1\">\n    \t<div class=\"module-buttons-item tf_inline_b\">\n\t\t\t\t\t\t\t<a href=\"#\" class=\"ui builder_button tb_default_color\" >\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"tf_inline_b tf_vmiddle\">Give as a Feedback and Suggest Questions<\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t    \t<\/div>\n\t<\/div>\n<!-- \/module buttons -->\n\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t<\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Every developer working with AL, probably, have been in a situation where there was the need to use an event. One of the main challenges of interacting with Microsoft D365 Business Central standard code if finding the event where the customization should fit. These events are often hard to find when coding, and there are [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":40785,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2065,2125],"tags":[2087,2088,2137],"acf":[],"_links":{"self":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts\/40758"}],"collection":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/comments?post=40758"}],"version-history":[{"count":0,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/posts\/40758\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/media\/40785"}],"wp:attachment":[{"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/media?parent=40758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/categories?post=40758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arquiconsult.com\/es\/wp-json\/wp\/v2\/tags?post=40758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}