Exploring Business Events for Business Central: Customer Credit Limit

Do you want to easily automate responses to common events in your ERP? 

With Business Events & Power Automate you can do just that in Business Central and other Dynamics 365 apps. Business events on Business Central (preview) - Business Central | Microsoft Learn.

In the most recent update Business Events can be used without any Dataverse setup making the toolset more accessible to all. 

So what do we get at the moment you ask? Here is a list:

  • Customer blocked
  • Customer unblocked
  • Opportunity activated
  • Opportunity closed as lost
  • Purchase credit memo posted
  • Purchase invoice posted
  • Purchase order released
  • Purchase payment posted
  • Purchase receipt posted
  • Quote created for opportunity
  • Sales credit limit exceeded
  • Sales credit memo posted
  • Sales invoice posted
  • Sales order released
  • Sales payment posted
  • Sales shipment posted
  • Winning quote converted into sales order 

Sales credit limit exceeded

Looking at the available list of events this one jumped out as its one of those events that happens usually between the sales team and finance. Sales stereotypically keen to get the sales on the system, finance with a more discerning eye on things like credit limits / credit insurance.

Setup the flow

Could not be easier just 2 elements 
  • When a business event occurs
  • Update record
The Business Event trigger provides the CustomerID that can be fed into the Update record. As usual to find out the expected value to pass back I used Get Record to check what to send to set Blocked = All. In this case it was just "All".

Power automate flow to block customers who exceed their credit limit

Testing

In Business Central there are a few different flavours of the Credit Limit. Let’s look at this for a moment to understand how the flow works.

Customer Card Credit Limit

The balance due shown on this screen and the format of the Credit limit cell is simply based on posted ledger entries: 


Customer statistics shows the 'Usage Of Credit Limit' of 98% based on the ledger total of 13,696 over a credit limit of 14,000.

We can also see on the Customer Statistics other unposted documents that are in draft or released:


Sales Document Credit Limit

Here the user is immediately advised that the customer's credit limit has been exceeded - note I am yet to enter any sales lines.


On the document customer details the credit limit shows with red italics and the available credit is calculated.   


If we drill down on the Available credit value we get to the, very handy, Available Credit page.


Turns out the Business Event 'Sales credit limit exceeded' is triggered by the ledger entry calculation, meaning only when a sales order is posted as an invoice (that then takes the customer over their credit limit) will the event activate.

Timing

Some power automate flows can take a few mins to run. This doesn't appear to be the case for business events. The update is instantaneous. 




Next post 

I'll run through some of the other business events and see what I can put together. The flows I have created however simple, I'll upload to this GitHub repo https://github.com/andywingate/d365bc-PowerAutomateFlows