MADIC dynamics Knowledge Hub Webinars: Extending Business Central with Power Automate

MADIC dynamicsIn our most recent webinar here at MADIC dynamics, we took a look at Extending Business Central with Power Automate.

If you want to catch up on this webinar, you can do so here.

What is Power Automate? ^

Power Automate is part of the Power Platform from Microsoft.

Power Platform is a collection of services which allow organisations to build their own solutions through low- or no-code services, such as Power BI (reporting), Power Apps (custom apps), Power Pages (websites) and Power Automate (automation). The idea is that they are low- or no-code and therefore do not require a developer to build the solution, and also allow for more rapid building than traditional applications, websites or other extensions.

We looked specifically at Power Automate in this webinar; Power Automate lets users create automated workflows between applications and services, allowing for repetitive business processes such as communications and approvals, to be automated.

As a relevant aside, I am currently writing two series of articles on Power Automate; the first is Working with Power Automate and the second is In Microsoft Dynamics 365 Business Central (Power Automate), how do I…. There is a large overlap between articles in those two series and this webinar, so I will be linking to the series where possible.

Types of Cloud Flow ^

There are four types of cloud flow available with Power Automate in combination with Business Central.

In the Microsoft documentation, they only show three types of cloud flow, but I always include the fourth, approvals, as this constitutes a large segment of the flows used by clients on Business Central, for users who have decided that the standard workflows don’t provide the flexibility required.

Icons for cloud flow types

Flow type Use case Automation target
Automated flows Create an automation that is triggered by an event such as a record being created or changed. Connectors for cloud or on-premises services connect your accounts and enable them to talk to each other.
Instant flows Start an automation with a click of a button. You can automate repetitive tasks such as sending an email to a salesperson or customer from a customer card or sales quote. Wide range of tasks such as requesting an approval, an action in Teams or SharePoint.
Scheduled flows Schedule an automation such as weekly run of invoice reminders to customers. Tasks that need to be automated on a schedule.
Approval flows Create an automation that is triggered by a user requesting approval in Microsoft Dynamics 365 Business Central. Approval of purchase or sales documents, or changes to master records such as accounts, vendors or items.

Connectors ^

A connector is how Power Automate connects to apps, data and services. There is a large ecosystem of SaaS (software-as-a-service) connectors available from both Microsoft and many other organisations.

Examples of connectors from Microsoft include:

  • Business Central
  • One Drive for Business
  • Excel Online
  • SharePoint
  • Teams
  • Outlook

In the wider ecosystem there is a huge number of third party connectors available, including:

  • SMS
  • Google
  • Jira
  • Salesforce
  • Adobe Acrobat
  • DocuSign
  • MailChimp

Triggers ^

A trigger is an event which initiates a Power Automate flow, such as a new record created,a record changed or deleted, or the user pressing a button; the available triggers depend on which connector is in use.

For Business Central there is quite a few triggers available:

Trigger Description
For a selected record (V3)

Triggers a flow for a selected Dynamics 365 Business Central record. (Available only for Power Automate.)

When a business event occurs (V3) (Preview)

Triggers a flow when a certain business event occurs in Dynamics 365 Business Central.

When a customer approval is requested (V3)

Triggers a flow when a customer approval request occurs in Dynamics 365 Business Central.

When a general journal batch approval is requested (V3)

Triggers a flow when a general journal batch approval request occurs in Dynamics 365 Business Central.

When a general journal line approval is requested (V3)

Triggers a flow when a general journal line approval request occurs in Dynamics 365 Business Central.

When a purchase document approval is requested (V3)

Triggers a flow when a purchase document approval request occurs in Dynamics 365 Business Central.

When a record is changed (V3)

Triggers a flow when a record is created, modified or deleted in Dynamics 365 Business Central.

When a record is created (V3)

Triggers a flow when a record is created in Dynamics 365 Business Central.

When a record is deleted (V3)

Triggers a flow when a record is deleted in Dynamics 365 Business Central.

When a record is modified (V3)

Triggers a flow when a record is modified in Dynamics 365 Business Central.

When a sales document approval is requested (V3)

Triggers a flow when a sales document approval request occurs in Dynamics 365 Business Central.

When a vendor approval is requested (V3)

Triggers a flow when a vendor approval request occurs in Dynamics 365 Business Central.

When an item approval is requested (V3)

Triggers a flow when an item approval request occurs in Dynamics 365 Business Central.

When working in Power Automate you’ll see that there are v2 and v3 versions of the Business Central triggers; you should always use the v3 where possible as the v2 are regarded as deprecated and could potentially be removed.

Actions ^

In a Power Automate flow, a step is an action in which the flow does something. as well as generic actions within Power Automate, there are also actions available for the selected connectors, which provide specific functionality.

For Busines Central, there are a few actions available:

Actions Description
Create record (V3)

Creates a Dynamics 365 Business Central record

Delete record (V3)

Deletes a Dynamics 365 Business Central record

Find records (V3)

Retrieves Dynamics 365 Business Central records of a certain type (for example, customers or items)

Get adaptive card (V3)

Retrieves an adaptive card for a Dynamics 365 Business Central url.

Get an image, file or document (V3)

Retrieves the content of an image, file or document in Dynamics 365 Business Central.

Get record (V3)

Retrieves a Dynamics 365 Business Central record

Get url (V3)

Generates a URL to access the specified Dynamics 365 Business Central record in the browser.

List companies (V3)

Retrieves all companies available in the specified Dynamics 365 Business Central environment.

Run action (V3)

Runs a Dynamics 365 Business Central action.

Update an image, file or document (V3)

Updates the content of an image, file or document in Dynamics 365 Business Central.

Update record (V3)

Updates an existing Dynamics 365 Business Central record

When Microsoft Dynamics 365 Business Central 2024 Wave 1 is released, a new Find a Matching Record action will be available, which allows you to select a single record and not manage the returned data in a loop (which the usual find records one requires).

How to Create a Power Automate Flow ^

There is now three ways to create a Power Automate flow:

  1. Manualy where you build the flow step-by-step.
  2. From a pre-built template; these can give a good starting point, but may need to be adjusted to fit exact requirements, and some of the templates are using the v2 triggers and actions rather than the v3, so may need updating this way too.

    Templates can be browsed to find and select a suitable one.

  3. Using AI which is closely related to doing it manually, but allows you to tell the AI what ou want the flow to do and it will create the steps. How good the result is will depend on how good your prompt is at describing requirements. AI is currently a little limited and may not always be available.

Typical Use Cases ^

As we’ve looked at in previous sections, there are a lot of triggers and actions which can be used in Power Automate to extend Business Central.

Icons for typical use cases

The most common use cases for Power Automate to extend Business Central, which I have discussed with clients are:

  1. Approvals for purchase quotes, orders or invoices, customer change or credit limits on sales orders and more. While Business Central does have a workflow module for approvals, it is quite limited and lacks flexibility. Power Automate allows for much more flexibility and complexity, like checking if a user is out of office and automatically delegating the workflow to another user instead.
  2. Process automation such as putting a customer on or off hold. This could either be at the click of a button or on an schedule.
  3. Document distribution instead or alongside the standard emailing functionality of Business Central. Examples of document distribution include allowing a user to select from a predefined list of letters which can be sent to a vendor or customer which mail merges information from Business Central into a Word document which is converted to PDF and then emailed.

Examples of Flows ^

There were four examples of workflows shown in the webinar, which closely align with the typical use cases discussed above.

Purchase Quote and Order Approval ^

The purchase quote approval shown was a two level approval where the first level approver was checked to see if they were out of office and, if they were, the first level of approval was skipped. This could have been set up to delegate the approval to another user instead, but this was a simple example created as a proof of concept.

I then quickly showed a purchase order approval showing that the approval email could be customised to include details of the lines on the order, allowing the approver to see all relevant information without needing to log in to Business Central.

Customer Hold ^

Document Distribution and Order Approval ^

This was a more complex workflow created as a proof of concept based on client requirements.

It allows the user to select up to four documents on the Customer card in Business Central. When they start the workflow it checks which documents are requested does the following:

  1. Compiles a list of the requested documents and initiates an approval.
  2. Once approved, an email is sent to the originator as confirmation.
  3. For each requested document, it mail merges the data out of Business Central into a Word template (merging of rows of transactions and a picture were included) and saved to OneDrive for Business.
  4. The Word documents are converted to PDF.
  5. The Word documents are deleted from OneDrive for Business.
  6. A version number for the documents is written back to a field in Business Central.
  7. The PDF documents are attached to an email and sent to the customer.

This was a simple example; we also discussed having conditions to print a physical copy of the document and also uploading them to DocuSign for signing; the signing details can be returned for processing in the flow, so a message by email or in Teams could be sent confirming they have been signed.

Approach to Power Automate ^

Power Automate is a fantastic tool for extending Business Central, giving you access to highly customisable flows for approvals, process automation and much more. But with this flexibility comes a level of risk.

How you approach Power Automate is a topic I didn’t get to cover in the webinar, but is very important to consider before getting started.

It is very easy to rush into creating flows on the production system, but this can lead to a messy situation with conflicting flows and other problems.

I always recommend that the creation of flows follow a standard project approach, to make sure that requirements are fully understood and so any conflicts are avoided. Power Automate is a low- or no-code service which does not (usually) require the involvement of a developer, unless you need to extend the tables and fields available through an API or add other custom functionality.

However, you should still follow development practices such as ALM (Application Lifecycle Management) when designing and building your Power Automate flows.

In simplistic terms, this means you need to implement the following:

  1. Environments – separate environments are required for development, quality assurance and development; in a lot of cases I’d also recommend a separate environment for user acceptance testing.

    These four environments are the ones we use when developing extensions for Business Central:

    • Development is where the Power Automate flows are built.
    • Quality Assurance is where the flow is tested to make sure it works correctly.
    • User Acceptance testing is where the end users test, both to make sure it works correctly, but also that it matches the original specification in functionality and that nothing needs to be changed.
    • Production is your live system and flows should only be deployed here when it is confirmed that there are no issues.
  2. Solutions – are used to group all components of a project into a set which can be managed and deployed together.

    There are two types of solution:

    • Unmanaged solutions are used on development environments where you have full access to the flows, connections, triggers, actions and so on.
    • Managed solutions should be exported from development and imported into other environments for testing and deployment.

      An unmanaged solution should never be deployed to a production system. I’d recommend that QA and UAT also only ever have managed solutions imported.

      Managed solutions can also be configured so properties of the components are managed and cannot be amended on production.

  3. Source Control allows you to keep versions of the Power Automate solution in case you need to revert back to a previous version. There is no built-in source control in Power Automate, so you will need to export the unmanaged solution and add it to your source control system.

    For personal projects I use Microsoft GitHub which is a very popular source control system.

    When you export solutions you can version number them, which allows you to keep track of which version is most recent; I always follow a form of Semantic Numbering (referred to as semver).

  4. Child Flows allow two main benefits:
    1. You can re-use child flows from as many other flows as you need while only creating the functionality once. For example, I may want to get the approver for a user and could do this in a child flow as I would want it in every flow.
    2. You can break down a large flow into a parent and several child flows, which can make the flow much more readable in future when you come back to make changes.
  5. Scopes can be used to group related actions within a flow; there is an overlap with how you should break down flows into parent/child flows and how you can group with scopes. Scopes can also be used for managing error handling of a set of scopes rather than needing to do them individually.
  6. Eror handling is important but often overlooked. It is easy to create a flow which works for the expected circumstance, but what happens if a record being searched for can;t be found, or if a field is expected to be populated, but isn’t? The flow needs to cater for these differences and manage any errors produced, so that users know the flow has failed.

Hopefully, the above is explained well enough that you can see the benefits of managing Power Automate flows within a standard project approach, so as to minimise future problems and make sure the implemented flow works and doesn’t conflict elsewhere.

The typical stages of a project, as we conduct them at MADIC dynamics, as a brief summary, are:

  1. Analysis and Design – gather requirements and produce specification for development.
  2. Project Planning and Estimates – who by and when are tasks going to undertaken.
  3. Configuration and Development – environments, solutions and flows are created.
  4. Deployment – UAT and user training
  5. Operational – implementation and go-live on production.

I have a lot of experience delivering projects as a consultant with Microsoft Dynamics ERP and I approach Power Automate projects in much the same way as I do those Business Central projects as the overall steps and approach required aren’t much different.

Different people will take different approaches, but I’d suggest that the differences are minor when it comes to delivering a successful Power Automate project, and which doesn’t store problems for the future. We at MADIC dynamics can help you plan to be successful with Power Automate projects and assist as much, or as little, as required as you get started extending Business Central with Power Automate.

Conclusion ^

Power Automate is a very quick and easy way to extend the functionality of Business Central. Whether it is approvals, process automation or document distribution, just as examples, there is a lot which can be done with it quite quickly which can have positive benefits to users and their organisations.

You do need to have controls and processes in place for how you design and build flows to make sure you don’t make a quagmire which is difficult to navigate in future.

The webinar recording is available.

What should we write about next?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Leave a Reply

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