Power Automate + F&O: Case Study – Part 2

We have already covered some cases in the first part of Power Automate + F&O, describing how workflows, alert rules, instant flows, and inbound flows might be used. Hence, Let’s delve into how Odata Actions, Custom Business Events, and Scheduled Flows can be handy.

Case Study: OData Actions

We can use Power Automate to trigger OData actions by using the “Execute action”. Actually, there are plenty of actions available on entities out of the box, which are required and used as part of the workflow process (covered in the previous article).

OData action is a method that is on the OData entity. Hence, you have the ability to extend existing entities or create brand new entities with these OData actions. The key here is that you can decorate those methods with the SysODataAction attribute. 

Here is an example of a very simple one:

The part with the comment “ //do something” is the place where you would write your code that does whatever the action is that you want to perform in the system automatically.

It’s important to note that custom OData actions can optionally take parameters, allowing you to add multiple steps. To do that, search for the D365 Fin&Ops Connector. Then, select the “Execute action”. 

The instances are available in a drop-down under “Instance”.

Once you have selected the instance – head to the dropdown box of the “Action” – that’s the place where you will see the full list of all of the OData actions that are available in the system. 

The additional attributes (Company, BOM ID, personnel number) are specific to the Odata action that you are calling. For this particular example, we use OData action to approve a Bill of Material, that we might be executing after some sort of approval process. Once done it should update an approved Bill of Material in the system.

Case Study: Custom business events

Another way we can use Power Automate for is to create custom business events. There are a variety of business events, that are not specific to workflows or alerts, already available out of the box. But, you also have the ability to extend the system and create your own custom business events.

Let’s have a look at a few custom ones, mainly automatic production processes, month-end, and procurement.

For production processes, we might make a business event where a production order is started, finished, or BOM is approved.

If we are trying to automate the month-end process, we could create a business event that’s triggered once:

  • a period is closed;
  • a task is completed or created inside of the financial period;
  • the consolidation is performed.

With procurement, here are three examples that are included out of the box:

  • when a purchase requisition is approved;
  • when a purchase order is received
  • when vendor invoices are posted.

There are many other ways to use these business events to trigger events and be the starting point of the Power Automate flow. We encourage you to check these links for further examples and scenarios:

Business Events Developer Documentation

Business Events Use Cases

Case Study: Scheduled Flows

Next up here are scheduled flows. You can think of these as like of a batch job. In F&O, if we have custom logic that needs to be executed on a specified interval (i.e. daily or nightly), we oftentimes would create custom classes that extend the batch framework and allow us to schedule those jobs. 

Another way you could consider approaching those requirements is by using a scheduled flow. A scheduled flow allows you to set up and define a schedule of the frequency that you want something to happen, whether that be once a day, at a certain time, or every so many minutes.

You may also specify that “something” should always occur on the 28th of each month, or after a certain number of days, hours, or minutes.

Hence, you could automate some quality processes. Let’s say, twice a day, new quality order tests should be created based on data that we have in F&O environment. Or, the quality order statuses should be updated with some information or data from another system every hour.

If you are trying to automate your month-end processes, I might copy month end tasks to a team site or to a planner, for instance, on a specific day of the month.

We might also automatically perform actions at a specific date and time. So, for instance, if we want to automatically close the period or automatically post to a particular journal (i.e. payroll entity) – we could tell the system to get the data needed and perform an OData action, or insert records into F&O on a certain date, and on a certain time.

We have the ability to process a list of items as well: 

  • To check credit limits, at a certain frequency. As the addon, we may include customers who are exceeding their credit limits in an email, or in a specific report;
  • To perform weekly checks on the status of journals;
  • To check and make sure that the employees have posted their timesheet at the end of the day. And if they have not – email them a reminder.