How To Setup D365 Business Event Part 2

Share this:

Activate A D365 Business Event

In the last post we explained how to setup the endpoint for a D365 Business Event. https://dynamics365musings.com/how-to-setup-d365-business-events-part-1/

Continuing that process, we will activate the D365 business event and connect it to the endpoint that we setup. This will cause the D365 business event message to be sent to the endpoint.

Go to System Adminstration > Setup > Business events > Business events catalog

Select the business event you wish to activate.  In this case, I selected the business event ID ‘SalesInvoicePostedBusinessEvent’.  This will trigger whenever a sales order is invoiced.

Next, select the ‘Activate’ link’:

D365 Business events

This shows a dialog box.  Enter in the legal entity and endpoint that you wish the business event to be sent to.  Specify the Endpoint name we setup in the previous blog post.  Click ‘ok’.

Configure new D365 Business Event

Select the ‘Active events’ tab, and Verify that the business event is indeed activate.

Active D365 Business Event

Setup The Business Events Batch Job

There is still a few more steps that must be taken in order for business events to work at all.  By default they are not enabled in the D365 system.

Go to ‘Business events parameters’ form in D365

Check the ‘Use business events batch job’ radio button.  The link ‘Business events batch job’ will become visible.  Select the link to open the batch job dialog form.  Fill out the dialog and make sure to setup the batch job to run with a re-occurrence.  This job will be responsible for processing the business event messages and sending them out, once they are created.  So for testing purposes, set the re-occurrence to something like 1 minute.

D365 Business event parameters

Enable D365 Business Events At The System Level

Unfortunately there is still one more thing needed to enable business events. 

Open sql server management studio, and connect to the ‘AxDB’ database.  Then run the following sql statement:

Update BUSINESSEVENTSPARAMETERS Set Enabled = 1

Microsoft has a second ‘Enabled’ flag that is not visible on the Business events parameters form, that can only be set through a sql statement.  If you are working in a development environment you will be able to perform this step.  If you are using a Tier 1 machine, then you need to request Microsoft make this change for you.

Validate The Events Are Being Processed

Finally, to test out the business event functionality run the functional process that triggers the business event to be created.  In our case we activated the business event that will trigger when we invoice a sales order.  So we will go ahead and create and invoice a sales order.

Next, to verify that your business event has worked, use sql server management studio.  Run the following sql statement:

select * from BUSINESSEVENTSCOMMITLOG

If you run this query right after you invoice the sales order, you will see your message staged in this table.

Next, depending on the reoccurrence you setup, the business events batch job will run, and process the records in this table.

If your business event is processed successfully it will be removed from the BusinessEventsCommitLog table and be sent to your endpoint.  If there is an error, the record will still be removed from the BusinessEventsCommitLog table, however, it will be inserted into the BusinessEventsExceptionLog table. 

From here you have two options:

Option 1: View the records in this table by using sql server management studio again and running this query:

select * from BUSINESSEVENTSEXCEPTIONLOG order by EventTime desc

Option 2: Go to the ‘Business Events catalog’ form in D365, and then click on the ‘Errors’ tab.  There is an ‘exception message’ that will tell you what error occurred.

In the next blog post, I will explain how to create a custom business event.

Peter Ramer
Peter Ramer is a part of the Managed Application Services team at RSM working on Microsoft Dynamics 365. He focuses on the Retail and Commerce industries. When he is not solving problems and finding ways to accelerate his clients' business, he enjoys time with his three kids and amazing wife.

Share this:

3 thoughts on “How To Setup D365 Business Event Part 2

Add yours

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑