Breaking news from around the world
Get the Bing + MSN extension
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | View virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
If you just started working with Dynamics 365 Business Central events, you should read this short article from Microsoft first. If you are already familiar with what the events are, let‘s dig further into that. Everyone knows that 365 Business Central Upgrade to events might be real trouble sometimes. In this blog post, I will explain how to manually upgrade Dynamics 365 Business Central Code to events.
There are four types of Dynamics 365 Business Central events. Now, let’s analyze them more detailed.
Business Event – a custom event that is promised not to change in future releases.
Integration Event – a custom event without promise to not change it in the future.
Global – predefined system event.
Trigger – system events predefined on the trigger.
Now, when we already know 4 types of Dynamics 365 Business Central events, let’s talk about the identification of subscriber events.
For subscriber events identification, you can use RTC or Vs Code Event Recorder.
Step 1: To use Event recorder from VS Code type ‘AL: Open Events Recorder’ in a command line:
Step 2: Hit ‘Start record’ button:
Step 3: Open one or another page or try to post something and after that hit ‘Stop button’ in Events Recorder:
Step 4: I opened ‘Customers page’ and there are all events that occurred during the opening and closing this page:
You should repeat the same steps for Windows Client as well.
When upgrading to Dynamics 365 Business Central events, there is a possibility to create your own events which consist of publisher, subscriber, and event definition. Let‘s start with the definition of a publisher. A publisher is a place where you hook to an event. Equally important to mention a subscriber, which is a function that has a logic and hooks to an event. Finally, an event definition is an empty function that defines your event.
I will start with a short tutorial of how to create an event in C/Side.
Step 1: For step one I chose page 22 ‘Customer List’. First of all, you have to create a function that defines where the event is going to be raised. For this example, I created an OnBeforeOpenPage function.
Step 2: Set up the function properties and your event parameters:
Events = Publisher;
EventType = Integration;
After setting up the properties and parameters, you should see something similar to this function:
Step 3: Set an event publisher. As this event name says, I put the event on the OnOpenPage trigger start:
Step 4: Create event subscribers codeunit as well as subscriber function. In this example, I named this function OnBeforeOpePageSubscriber;:
Step 5: Now, set function properties:
Step 6: Write some test code:
Step 7: Test your new event:
Step 1: For this example, I used the Customer List extension object. To create new integration event use snippet “tevntint”:
Step 2: Place the function of a publisher:
Step 3: Finally, don‘t forget the subscriber in new codeunit:
Step 4: Try your new event, now in extensions:
Step 1: Find an event you want to subscribe to. In this example, I choose the page ‘Customer List‘ event OnClosePage:
Step 2: Create event subscriber in your subscribers codeunit. If you still haven’t defined one, this is the perfect opportunity to do so. For subscriber event creation don’t forget to use snippet ‘teventsub’:
Step 3: Try your new event subscriber:
In order to make your work easier, there is one trick with OnBefore table. Predefined events work even if their trigger code is disabled. For example, if Record.Delete(False) OnDelete trigger code is not going to be executed, OnBeforeDeleteEvent code still will be executed. There is a table that shows which triggers support such logic:
To conclude, these steps should help you successfully upgrade to Dynamics 365 Business Central events manually. Alternatively, if you are interested in the free offer for Upgrade the Add-on or a customized solution to Extensions, just submit the form below and we will contact you shortly.
The post How to manually upgrade to Dynamics 365 Business Central events appeared first on Simplanova.
Business Applications communities