Custom D365 F&O business event to Power Automate or Azure
Create a custom business event in D365 F&O: event class, contract, sending, then consumption by Power Automate, Service Bus or Event Grid.
The short answer
A custom business event in Dynamics 365 Finance & Operations relies on two X++ classes: an event class extending BusinessEventsBase (with the BusinessEvents attribute) and a contract class extending BusinessEventsContract (the payload). You then call send() at the right point in the business code. After deployment, the event appears in the business events catalog, where you activate it to an endpoint: Power Automate, Azure Service Bus, Azure Event Grid, HTTPS and so on.
Microsoft is clear about usage: a business event is for triggering a business action outside F&O (notify, start a flow), not for exporting data. To transfer data, use the existing export mechanisms.
Step 1: the event class
Microsoft naming convention: <noun><past-tense action>BusinessEvent, for example VendorInvoicePostedBusinessEvent. The class has a static newFrom… constructor, a private new, private parm methods and buildContract. Full Learn example:
[BusinessEvents(classStr(SalesInvoicePostedBusinessEventContract),
'AccountsReceivable:SalesOrderInvoicePostedBusinessEventName',
'AccountsReceivable:SalesOrderInvoicePostedBusinessEventDescription',
ModuleAxapta::SalesOrder)]
public class SalesInvoicePostedBusinessEvent extends BusinessEventsBase
{
private CustInvoiceJour custInvoiceJour;
static public SalesInvoicePostedBusinessEvent newFromCustInvoiceJour(CustInvoiceJour _custInvoiceJour)
{
SalesInvoicePostedBusinessEvent businessEvent = new SalesInvoicePostedBusinessEvent();
businessEvent.parmCustInvoiceJour(_custInvoiceJour);
return businessEvent;
}
private void new()
{
}
private CustInvoiceJour parmCustInvoiceJour(CustInvoiceJour _custInvoiceJour = custInvoiceJour)
{
custInvoiceJour = _custInvoiceJour;
return custInvoiceJour;
}
[Wrappable(false), Replaceable(false)]
public BusinessEventsContract buildContract()
{
return SalesInvoicePostedBusinessEventContract::newFromCustInvoiceJour(custInvoiceJour);
}
}The attribute's name and description arguments are labels.
Step 2: the contract and sending
The contract extends BusinessEventsContract, carries the DataContract attribute, holds private variables (invoice number, amount, date…), a protected initialize method, a static constructor and parm methods decorated as DataMember. It defines the JSON that is sent.
Send the event where the information is available, ideally in the business logic rather than at table level: you keep business context and avoid "noise". Sending is tied to the transaction commit: if it is aborted, the event is not sent. If preparing the event is expensive, check first that it is enabled:
if (BusinessEventsConfigurationReader::isBusinessEventEnabled(classStr(CollectionStatusUpdatedBusinessEvent)))
{
// expensive logic only when the event is enabled
CollectionStatusUpdatedBusinessEvent::newFromCustDispute(dispute).send();
}Step 3: activate and consume
The catalog is rebuilt during database synchronisation at deployment; otherwise use Manage > Rebuild business events catalog. In the Business events workspace, create an endpoint (Power Automate, Service Bus, Event Grid, HTTPS…) then activate the event for one or more companies. Power Automate can also subscribe directly. Azure or Power Automate subscriptions are your own.
Common mistakes
- Using a business event to export data in bulk: a misuse according to Microsoft.
- Capturing the event at table level (insert/update): business context is lost, filters get complex, and the event may be missed if data goes another way.
- Building the contract even when the event is not enabled, on an expensive process.
- Forgetting to rebuild the catalog: the event does not appear.
- Sending a "false" event (before the operation is really committed): the recipient must be able to trust it.
Having it generated
Event class, contract, labels and sending point: a custom business event is a short, well-bounded development. Skalp AI writes the specification, generates the X++ code and unit tests, compiles with a best-practice check, then delivers a pull request to your Azure DevOps: nothing is merged without your technical architect's approval. See D365 F&O workflow automation and D365 F&O API interfaces, the bigger picture in building X++ without a consultant in 2026, and the Basic, Pro and Max plans (1 credit, ≈ €400 on Basic, €200 on Pro, consumed only when the code is generated).
See also: EDI DESADV in D365 F&O.
Sources
- Microsoft Learn, "Business events developer documentation", updated 15 Jan 2026, accessed 18 Oct 2026.
- Microsoft Learn, "Business events overview", updated 15 Jan 2026, accessed 18 Oct 2026.
Frequently asked questions
What is the difference between a business event and a data export?
A business event signals that a business operation happened, to trigger an action elsewhere. To transfer data volumes, Microsoft recommends export mechanisms (data entities, DMF).
My business event is missing from the catalog, why?
The catalog is built during database synchronisation. Run Manage > Rebuild business events catalog and check the class carries the BusinessEvents attribute.
Is the event sent if the transaction fails?
No. Sending is tied to the transaction commit; if it is aborted, the event is not sent.
Ready to transform your D365?
Join the CIOs who develop their D365 tickets in 2–4 h for 1 credit (≈ €400 on Basic, €200 on Pro).